SQL CREATE TABLE Statement
Submitted by admin on Monday, April 11, 2011 - 15:47.
After you create a database using the CREATE Database statement, you can now create a table. Table is where you store your data in your database.
SQL CREATE TABLE Syntax
- CREATE TABLE TABLE_NAME
- (
- column_name1 data_type,
- column_name2 data_type,
- column_name3 data_type,
- ....
- )
Example # 1
- CREATE TABLE Users
- (
- Firstname text,
- Lastname text,
- Salary FLOAT,
- DeptID INT
- )
Users
Firstname | Lastname | Salary | DeptID |
---|
This command will create an empty table with named "Users" and the data types for each column. Now we can populate the table by using SQL INSERT statements.