March 26, 2021

How to create a table using PostgreSQL?

Syntax:
CREATE TABLE table_name (
   column1 datatype(length) column_contraint,
   column2 datatype(length) column_contraint,
   column3 datatype(length) column_contraint,
   table_constraints
);


Example:
CREATE TABLE interested_car (
    id SERIAL PRIMARY KEY,
    interested_car_name VARCHAR ( 50 ) NOT NULL
);


SERIAL - for auto increment

No comments:

Post a Comment