SQL Basic
SQL Advanced
SQL Functions
| SQL Create Table |
The CREATE TABLE StatementThe CREATE TABLE statement is used to create a table in a database. SQL CREATE TABLE Syntax
The data type specifies what type of data the column can hold. For a complete reference of all the data types available in MS Access, MySQL, and SQL Server, go to our complete Data Types reference. CREATE TABLE ExampleNow we want to create a table called "Persons" that contains five columns: P_Id, LastName, FirstName, Address, and City. We use the following CREATE TABLE statement:
The P_Id column is of type int and will hold a number. The LastName, FirstName, Address, and City columns are of type varchar with a maximum length of 255 characters. The empty "Persons" table will now look like this:
The empty table can be filled with data with the INSERT INTO statement. |
SQL Create Table