To create table in SQL you have to use following syntax
CREATE TABLE table_name (
column_1 datatype,
column_2 datatype,
column_3 datatype
);
It's important to place comma after each column definition, and semicolon after whole statement.
Here's real life example:
CREATE TABLE users (
id INT,
name VARCHAR(255),
surname VARCHAR(255),
email VARCHAR(255),
password VARCHAR(255)
);
This statement creates table with 4 columns. First one is of type INT which means integer value. The other 4 columns are of type VARCHAR(255) which means TEXT with maximum length of 255. You can place any number in brackets to define length.
Top comments (0)