DEV Community

Qing
Qing

Posted on

Creating a Table

Create an empty table in the current database. The table will be owned by the creator. The same table can be stored in different databases. You can execute the CREATE TABLE statement to create a table.

Syntax

Image description

Parameter Description
·table_name

Specifies the name of the table to be created.

·column_name

Specifies the name of the column to be created in the new table.

·data_type

Specifies the data type of the column.

Examples
Run the following commands to create a table named customer_t1. The table columns are c_customer_sk, c_customer_id,** c_first_name*, and **c_last_name*. The data types of the table columns are integer, char (5), char (6), and char (8), respectively.

Image description

If the following information is displayed, the table has been created:

CREATE TABLE

Top comments (0)