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;
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
1# updated dec 2020
2# Creates a Simple User table
3# Uses an auto-incrementing primary key as userId
4
5CREATE TABLE user (
6 userId INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
7 username VARCHAR(100),
8 password VARCHAR(100)
9) ENGINE=InnoDB;
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);
1#Assuming that there is a database called MyDatabase
2#creates a table called TableName, with columns Name, Age, and Class
3Use MyDatabase;
4create table TableName(
5 No. int primary key,
6 Name varchar(50),
7 Age int,
8 Class varchar(15));