· 9 years ago · Jan 29, 2017, 05:46 PM
1-- Create a database to keep record of the earnings of all users.
2CREATE DATABASE IF NOT EXISTS `Earnings_Record`;
3
4-- Create a table for each year containing 13 columns, the user ID and the 12 months.
5CREATE TABLE IF NOT EXISTS `Earnings_Record`.`Earnings_2017` (
6 `ID` INT(11) NOT NULL,
7 `January` VARCHAR(250) NOT NULL,
8 `February` VARCHAR(250) NOT NULL,
9 ...
10 `December` VARCHAR(250) NOT NULL,
11 PRIMARY KEY (`ID`)
12) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
13
14-- Create a database to keep record of the earnings of all users for 2017.
15CREATE DATABASE IF NOT EXISTS `Earnings_2017`;
16
17-- Create a table for each month with 28-31 + 1 columns, the user ID and the 28-31 days.
18CREATE TABLE IF NOT EXISTS `Earnings_2017`.`January` (
19 `ID` INT(11) NOT NULL,
20 `Day 1` DECIMAL(10, 2) NOT NULL,
21 `Day 2` DECIMAL(10, 2) NOT NULL,
22 ...
23 `Day 31` DECIMAL(10, 2) NOT NULL,
24 PRIMARY KEY (`ID`)
25) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;