mysql create table syntax example
Example 1: create table in mysql
CREATE TABLE user (
userId INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(100),
password VARCHAR(100)
) ENGINE=InnoDB;
Example 2: create table mysql
CREATE TABLE IF NOT EXISTS tasks (
task_id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
start_date DATE,
due_date DATE,
status TINYINT NOT NULL,
priority TINYINT NOT NULL,
description TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=INNODB;
Example 3: create table mysql query
create table tutorials_tbl(
tutorial_id INT NOT NULL AUTO_INCREMENT,
tutorial_title VARCHAR(100) NOT NULL,
tutorial_author VARCHAR(40) NOT NULL,
submission_date DATE,
PRIMARY KEY ( tutorial_id )
);