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;
1# Simple table describing a vehicle
2
3CREATE TABLE vehicle(
4 # vehicleId: Unique ID for Primary Key.
5 # This is how we will reference a record
6 vehicleId INT NOT NULL,
7 make VARCHAR(64), # String 64 chars max
8 model VARCHAR(128),
9 derivative VARCHAR(255),
10 PRIMARY KEY(vehicleId)
11);
12
13# Add a record
14INSERT INTO vehicle VALUES(1000,'Volkswagen','Golf','1.5 TSI EVO Match Edition 5dr');
1CREATE TABLE table_name
2(
3column1 TYPE [COLUMN CONSTRAINTS],
4column2 TYPE [COLUMN CONSTRAINTS],
5column3 TYPE [COLUMN CONSTRAINTS],
6[TABLE CONSTRAINTS...]
7);
1
2CREATE TABLE Persons
3(
4PersonID int,
5LastName varchar(255),
6FirstName varchar(255),
7Address varchar(255),
8City varchar(255)
9);
10
1CREATE TABLE utilisateur
2(
3 id INT PRIMARY KEY NOT NULL,
4 nom VARCHAR(100),
5 prenom VARCHAR(100),
6 email VARCHAR(255),
7 date_naissance DATE,
8 pays VARCHAR(255),
9 ville VARCHAR(255),
10 code_postal VARCHAR(5),
11 nombre_achat INT
12)
1CREATE TABLE fact (
2id SERIAL PRIMARY KEY NOT NULL,
3type VARCHAR(255),
4text TEXT
5);
6
7