SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE user_group ( "user_name" text unique not null, "user_id" uuid primary key not null default gen_random_uuid(), "email" text unique not null, "password" text not null, "user_level" text not null default 'normal', "accessible_product" text array, "accessible_user" text array, "create_date" timestamp(6) without time zone default (now() at time zone 'utc'), "register_date" int8 not null, "end_date" text not null, "valid_days" int4 not null, "last_login_info" _text, "is_insider" boolean not null default true ); insert into user_group( user_name, email, password, user_level, register_date, end_date, valid_days ) values( '456', '456@gamil.com', '456', 'normal', extract(epoch from (current_timestamp at time zone 'utc')), 'end_date', 100 ); insert into user_group( user_name, email, password, user_level, register_date, end_date, valid_days ) values( '123', '123@gamil.com', '123', 'normal', extract(epoch from (current_timestamp at time zone 'utc')), 'end_date', 100 ); insert into user_group( user_name, email, password, user_level, register_date, end_date, valid_days ) values( '777', '777@gamil.com', '777', 'normal', extract(epoch from (current_timestamp at time zone 'utc')), 'end_date', 100 ); update user_group set accessible_user= accessible_user || array ['123','456'] where user_name='777'; select * from user_group ; select * from user_group where '123' = any( array( select accessible_user from user_group where user_name = '777' ) );
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear