CREATE TABLE userstimeauth( id BIGSERIAL PRIMARY KEY, iduser BIGINT, timestamplastauth…
- User
CREATE TABLE users_time_auth( id BIGSERIAL PRIMARY KEY, id_user BIGINT, timestamp_last_auth TIMESTAMP NOT NULL, FOREIGN KEY (id_user) REFERENCES chat_users(id) );
CREATE TABLE user_mood( id BIGSERIAL PRIMARY KEY, user_id BIGINT REFERENCES chat_users(id), mood DECIMAL(10,1) NOT NULL CHECK ( mood>0 AND mood<1) ); Напиши по три insert postgres для них. С учетом - CREATE TABLE chat_users( id BIGSERIAL PRIMARY KEY, username VARCHAR(20) NOT NULL UNIQUE, first_name VARCHAR(30) NOT NULL, second_name VARCHAR(30) NOT NULL, data_create_account DATE, age SMALLINT, country_name VARCHAR, birthday DATE ); INSERT INTO chat_users (id, username, first_name, second_name, data_create_account, age, country_name, birthday) VALUES (1, 'zxqwelmn', 'Kldyal', 'Fyonps', '2022-01-15', 28, 'Qrmstia', '1995-06-24'), (2, 'knqwirza', 'Typsqi', 'Mvwroy', '2021-05-20', 32, 'Lolmfek', '1991-02-14'), (3, 'uqplonmc', 'Eyrnaw', 'Ilsbrt', '2023-03-12', 25, 'Qpekln', '1998-11-05'), (4, 'cjaklrie', 'Bvpaer', 'Rlwnek', '2022-07-09', 29, 'Plexmn', '1994-09-22'), (5, 'ubomejxk', 'Zhurtw', 'Ytxnei', '2020-11-23', 34, 'Afvujem', '1989-03-19'), (6, 'bfvszanp', 'Qyetns', 'Watdko','2021-02-01', 40, 'Plfmncd', '1983-12-08'), (7, 'aoklvwqe', 'Cytqwe', 'Dqlpvi', '2019-06-18', 27, 'Dlbvk', '1996-08-01'), (8, 'iqpamdfw', 'Rbmwak', 'Nxtwyz', '2022-09-13', 22, 'Yzrtkm', '2001-04-27'), (9, 'pqeuvnkl', 'Fxgmpv', 'Vupqjl', '2023-08-05', 19, 'Rmbvte', '2004-12-30'), (10, 'wlpweoiq', 'Nxkrqn', 'Iotwxe', '2021-12-14', 41, 'Bkplt', '1982-06-10'), (11, 'carebfjq', 'Tempoq', 'Yxvnel', '2020-04-27', 30, 'Rkrezmv', '1993-09-15'), (12, 'lasdhfrp', 'Tuthlm', 'Qbrwol', '2021-11-11', 37, 'Xmvznym', '1986-11-20'), (13, 'asohimvw', 'Ugrspo', 'Benumb', '2023-02-09', 23, 'Wtixdlb', '2000-05-25'), (14, 'bucnewqo', 'Lpwoqj', 'Mpxlka', '2018-10-31', 29, 'Vwejkz', '1994-10-03'), (15, 'bdlqwzem', 'Omfwel', 'Zpwkfj', '2019-05-14', 35, 'Lxzokm', '1988-01-22');
- Assistant
Here are three
INSERTstatements for each of the tablesusers_time_authanduser_moodthat are consistent with thechat_userstable you provided:sql-- Insert statements for the users_time_auth table INSERT INTO users_time_auth (id_user, timestamp_last_auth) VALUES (1, '2023-10-01 12:34:56'), (2, '2023-09-29 09:17:45'), (3, '2023-09-25 15:08:20'); INSERT INTO users_time_auth (id_user, timestamp_last_auth) VALUES (4, '2023-10-02 17:20:45'), (5, '2023-09-30 14:45:30'), (6, '2023-10-01 11:11:11'); INSERT INTO users_time_auth (id_user, timestamp_last_auth) VALUES (7, '2023-09-28 22:19:03'), (8, '2023-09-29 13:05:42'), (9, '2023-10-02 06:48:15'); -- Insert statements for the user_mood table INSERT INTO user_mood (user_id, mood) VALUES (10, 0.8), (11, 0.6), (12, 0.9); INSERT INTO user_mood (user_id, mood) VALUES (13, 0.5), (14, 0.7), (15, 0.3); INSERT INTO user_mood (user_id, mood) VALUES (1, 0.4), (2, 0.8), (3, 0.6);