1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| DROP TABLE if EXISTS Actions; DROP TABLE if EXISTS Removals; CREATE TABLE If NOT EXISTS Actions ( user_id INT, post_id INT, action_date DATE, action ENUM ('view', 'like', 'reaction', 'comment', 'report', 'share'), extra VARCHAR(10) ); CREATE TABLE if NOT EXISTS Removals (post_id INT, remove_date DATE); TRUNCATE TABLE Actions; INSERT INTO Actions (user_id, post_id, action_date, action, extra) VALUES ('1', '1', '2019-07-01', 'view', 'None'); INSERT INTO Actions (user_id, post_id, action_date, action, extra) VALUES ('1', '1', '2019-07-01', 'like', 'None'); INSERT INTO Actions (user_id, post_id, action_date, action, extra) VALUES ('1', '1', '2019-07-01', 'share', 'None'); INSERT INTO Actions (user_id, post_id, action_date, action, extra) VALUES ('2', '2', '2019-07-04', 'view', 'None'); INSERT INTO Actions (user_id, post_id, action_date, action, extra) VALUES ('2', '2', '2019-07-04', 'report', 'spam'); INSERT INTO Actions (user_id, post_id, action_date, action, extra) VALUES ('3', '4', '2019-07-04', 'view', 'None'); INSERT INTO Actions (user_id, post_id, action_date, action, extra) VALUES ('3', '4', '2019-07-04', 'report', 'spam'); INSERT INTO Actions (user_id, post_id, action_date, action, extra) VALUES ('4', '3', '2019-07-02', 'view', 'None'); INSERT INTO Actions (user_id, post_id, action_date, action, extra) VALUES ('4', '3', '2019-07-02', 'report', 'spam'); INSERT INTO Actions (user_id, post_id, action_date, action, extra) VALUES ('5', '2', '2019-07-03', 'view', 'None'); INSERT INTO Actions (user_id, post_id, action_date, action, extra) VALUES ('5', '2', '2019-07-03', 'report', 'racism'); INSERT INTO Actions (user_id, post_id, action_date, action, extra) VALUES ('5', '5', '2019-07-03', 'view', 'None'); INSERT INTO Actions (user_id, post_id, action_date, action, extra) VALUES ('5', '5', '2019-07-03', 'report', 'racism'); TRUNCATE TABLE Removals; INSERT INTO Removals (post_id, remove_date) VALUES ('2', '2019-07-20'); INSERT INTO Removals (post_id, remove_date) VALUES ('3', '2019-07-18');
|