1# Creates a Simple User table
2# Uses an auto-incrementing primary key as userId
3
4CREATE TABLE user (
5 userId INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
6 username VARCHAR(100),
7 password VARCHAR(100)
8) ENGINE=InnoDB;
1# Simple table describing a vehicle
2
3CREATE TABLE vehicle(
4 # vehicleId: Unique ID for Primary Key.
5 # This is how we will reference a record
6 vehicleId INT NOT NULL,
7 make VARCHAR(64), # String 64 chars max
8 model VARCHAR(128),
9 derivative VARCHAR(255),
10 PRIMARY KEY(vehicleId)
11);
12
13# Add a record
14INSERT INTO vehicle VALUES(1000,'Volkswagen','Golf','1.5 TSI EVO Match Edition 5dr');
1CREATE TABLE IF NOT EXISTS tasks (
2 task_id INT AUTO_INCREMENT PRIMARY KEY,
3 title VARCHAR(255) NOT NULL,
4 start_date DATE,
5 due_date DATE,
6 status TINYINT NOT NULL,
7 priority TINYINT NOT NULL,
8 description TEXT,
9 created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
10) ENGINE=INNODB;
11
1create table tutorials_tbl(
2 tutorial_id INT NOT NULL AUTO_INCREMENT,
3 tutorial_title VARCHAR(100) NOT NULL,
4 tutorial_author VARCHAR(40) NOT NULL,
5 submission_date DATE,
6 PRIMARY KEY ( tutorial_id )
7);
8
1create table tutorials_tbl(
2 tutorial_id INT NOT NULL AUTO_INCREMENT,
3 tutorial_title VARCHAR(100) NOT NULL,
4 tutorial_author VARCHAR(40) NOT NULL,
5 submission_date DATE,
6 PRIMARY KEY ( tutorial_id )
7);
1CREATE TABLE IF NOT EXISTS `sys_user_details` (
2 user_detail_id INT(11) AUTO_INCREMENT,
3 user_id INT(11),
4 name VARCHAR(100) NOT NULL,
5 email VARCHAR(200) NOT NULL,
6 education VARCHAR(100) DEFAULT NULL,
7 skills VARCHAR(100) DEFAULT NULL,
8 experience VARCHAR(100) DEFAULT NULL,
9 CONSTRAINT PK_sys_user_details PRIMARY KEY (user_detail_id),
10 CONSTRAINT FK_sys_user_details_user_id FOREIGN KEY (user_id)
11 REFERENCES sys_user(user_id)
12 ON UPDATE RESTRICT ON DELETE CASCADE
13);