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
CREATE TABLE table_name
(column_name data_type [, ... ]);
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.
openGauss=# CREATE TABLE customer_t1
(
c_customer_sk integer,
c_customer_id char(5),
c_first_name char(6),
c_last_name char(8),
Amount integer
);
If the following information is displayed, the table has been created:
CREATE TABLE
Feedback