create table in db postgres code example
Example 1: create table in postgresql
-- Example table
CREATE TABLE accounts (
user_id serial PRIMARY KEY,
username VARCHAR ( 50 ) UNIQUE NOT NULL,
password VARCHAR ( 50 ) NOT NULL,
email VARCHAR ( 255 ) UNIQUE NOT NULL,
created_on TIMESTAMP NOT NULL,
last_login TIMESTAMP
);
Example 2: show create table in postgresql
pg_dump -t 'schema-name.table-name' --schema-only database-name