In this short tutorial, I will show how to create a table in PostgreSQL.
To create a new table, we use the SQL CREATE TABLE command. The following is the syntax for creating a new table:
-- Creates a table with the name of Customers if the table does not exists. CREATE TABLE IF NOT EXISTS Customers ( -- Creates a column with the name of first_name that cannot be null. first_name VARCHAR (50) NOT NULL, -- Create a column with the name of email that is unique and cannot be null. email VARCHAR (250) UNIQUE NOT NULL, -- Creates a column with the name of age. This column can be null. age INT );
This creates a new table with the name Customers and the columns first_name, email and age.
You can learn more about Databases here