create table in mysql databases code example
Example 1: create table in mysql
# Creates a Simple User table
# Uses an auto-incrementing primary key as userId
CREATE TABLE user (
userId INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(100),
password VARCHAR(100)
) ENGINE=InnoDB;
Example 2: creating table in MySQL
#Assuming that there is a database called MyDatabase
#creates a table called TableName, with columns Name, Age, and Class
Use MyDatabase;
create table TableName(
No. int primary key,
Name varchar(50),
Age int,
Class varchar(15));