SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
DROP TABLE IF EXISTS `User`; CREATE TABLE IF NOT EXISTS `User` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Registration_MonthDate` int(11) NOT NULL, `Acquisition_source` varchar(255) NOT NULL, `User_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `User_id` (`User_id`) ); INSERT INTO `User` ( `id`, `Registration_MonthDate`, `Acquisition_source`, `User_id` ) VALUES (1, 1, "Google", 12), (2, 1, "Facebook", 13), (3, 1, "Google", 15), (4, 2, "Google", 16), (5, 2, "Google", 14), (6, 3, "Google", 17), (7, 3, "Facebook", 18), (8, 3, "Facebook", 19), (9, 3, "Facebook", 20), (10, 3, "Google", 21), (11, 5, "Google", 22), (12, 5, "Facebook", 23), (13, 5, "Google", 24), (14, 5, "Google", 25); DROP TABLE IF EXISTS `Monthly_Acquisition_cost`; CREATE TABLE IF NOT EXISTS `Monthly_Acquisition_cost` ( `id` int(11) NOT NULL AUTO_INCREMENT, `MonthDate` int(11) DEFAULT NULL, `Acquisition_source` varchar(255) NOT NULL, `Cost` int(11) DEFAULT NULL, PRIMARY KEY (`id`) ); INSERT INTO `Monthly_Acquisition_cost` ( `id`, `MonthDate`, `Acquisition_source`, `Cost` ) VALUES (1, 1, "Google", 1000), (2, 2, "Google", 1050), (3, 3, "Google", 950), (4, 4, "Google", 1200), (5, 5, "Google", 1500), (6, 1, "Facebook", 1000), (7, 2, "Facebook", 1050), (8, 3, "Facebook", 950), (9, 4, "Facebook", 1200), (10, 5, "Facebook", 1500); DROP TABLE IF EXISTS `Monthly_user_revenue`; CREATE TABLE IF NOT EXISTS `Monthly_user_revenue` ( `id` int(11) NOT NULL AUTO_INCREMENT, `MonthDate` int(11) NOT NULL, `User_id` int(11) NOT NULL, `Revenue` decimal(10, 4) DEFAULT NULL, PRIMARY KEY (`id`), KEY `User_id` (`User_id`) ); INSERT INTO `Monthly_user_revenue` ( `id`, `MonthDate`, `User_id`, `Revenue` ) VALUES (1, 1, 12, 1000), (2, 2, 12, 1000), (3, 3, 12, 1000), (4, 4, 12, 1000), (5, 1, 14, 1000), (6, 2, 14, 1000), (7, 3, 14, 1000), (8, 4, 14, 1000), (9, 1, 15, 1000), (10, 2, 15, 1000), (11, 3, 15, 1000), (12, 4, 15, 1000), (13, 5, 15, 1000), (14, 1, 16, 1000), (15, 2, 16, 1000), (16, 3, 16, 1000), (17, 4, 16, 1000), (18, 5, 16, 1000), (19, 1, 17, 1000), (20, 2, 17, 1000), (21, 3, 17, 1000), (22, 4, 17, 1000), (23, 5, 17, 1000), (24, 1, 18, 1000), (25, 2, 18, 1000), (26, 3, 18, 1000), (27, 4, 18, 1000), (28, 1, 19, 1000), (30, 2, 19, 1000), (31, 3, 19, 1000), (32, 4, 19, 1000), (33, 5, 19, 1000), (34, 1, 20, 1000), (35, 2, 20, 1000); COMMIT;
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear