Updated on 2025-05-29 GMT+08:00

Creating Tables

Context

A table is created in a database and can be stored in different databases. Tables under different schemas in a database can have the same name.

Creating a Table

Create a table.
1
2
3
4
5
6
7
gaussdb=# CREATE TABLE customer_t1
(
    c_customer_sk             integer,
    c_customer_id             char(5),
    c_first_name              char(6),
    c_last_name               char(8)
);

If the following information is displayed, the creation is successful:

1
 CREATE TABLE

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

  • By default, new database objects are created in the $user schema. For more details about schemas, see Managing Schemas.
  • In addition to the created tables, a database contains many system catalogs. These system catalogs contain database installation information and information about various queries and processes in GaussDB. You can collect information about the database by querying system catalogs. For details, see Querying System Catalogs.

    GaussDB supports row store, providing high query performance for interactive analysis in various complex scenarios.

  • For more details about how to create a table, see CREATE TABLE.