CREATE TABLE Persons (
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);
Creates a new table .
Example: Creates a new table called ‘users’ in the ‘websitesetup’ database.
CREATE TABLE users (
id int,
first_name varchar(255),
surname varchar(255),
address varchar(255),
contact_number int
);
CREATE TABLE li_wedding (
guest_id INT,
last_name VARCHAR(255),
first_name VARCHAR(255),
attending BOOL,
diet VARCHAR(255)
);
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
....
);
CREATE TABLE sales.promotions (
promotion_id INT PRIMARY KEY IDENTITY (1, 1),
promotion_name VARCHAR (255) NOT NULL,
discount NUMERIC (3, 2) DEFAULT 0,
start_date DATE NOT NULL,
expired_date DATE NOT NULL
);
Code language: SQL (Structured Query Language) (sql)
CREATE TABLE users ( )