my sql database how to create tables code 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;