Help Center > > Developer Guide> Database Quick Start> Creating and Managing Tables> Creating a Table

Creating a Table

Updated at: Jul 15, 2020 GMT+08:00

Context

A table is created in a database and can be saved in different databases. Tables under different schemas in a database can have the same name. Before creating a table, perform the operations in Planning a Storage Model.

For details about how to design a table suitable for services, see Excellent Practices for Table Design.

Creating a Table

Run the following statement to create a table:
1
2
3
4
5
6
7
8
9
CREATE TABLE customer_t1
(
    c_customer_sk             integer,
    c_customer_id             char(5),
    c_first_name              char(6),
    c_last_name               char(8)
)
with (orientation = column,compression=middle)
distribute by hash (c_last_name);

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

1
 CREATE TABLE

c_customer_sk, c_customer_id, c_first_name and c_last_name are the column names in the table. integer, char(5), char(6), and char(8) are column name types.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel