Search
 
SCRIPT & CODE EXAMPLE
 

SQL

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 
);
Comment

postgre sql create table

CREATE TABLE cities (
    city_id serial PRIMARY KEY,
    city_name VARCHAR (255) NOT NULL,
    population INT NOT NULL CHECK (population >= 0)
);

Comment

postgresql create table as select

CREATE TABLE films_recent AS
  SELECT * FROM films WHERE date_prod >= '2002-01-01';
Comment

create table postgresql

CREATE TABLE table_name (
	column_name TYPE column_constraint,
	table_constraint table_constraint
) INHERITS existing_table_name;
Comment

Create postgres table

CREATE TABLE holiday_calender (
	hcl_id bigserial NOT NULL,
	hcl_country integer,
	hcl_company integer,
	hcl_date timestamp NULL,
	hcl_description varchar(500) NULL,	
	hcl_active int4 NOT NULL,
	CONSTRAINT holiday_calender_pkey PRIMARY KEY (hcl_id)
);
Comment

show create table in postgresql

pg_dump -t 'schema-name.table-name' --schema-only database-name
Comment

PREVIOUS NEXT
Code Example
Sql :: oracle privileges users 
Sql :: sql insert into select 
Sql :: generate sql from specific migration ef core 
Sql :: how to find total working hour in sql 
Sql :: execut sql python 
Sql :: duplicate record mysql 
Sql :: sql default value if null 
Sql :: sql to linq 
Sql :: forcefully delete a row in mysql which has references 
Sql :: mysql:5.6 syntax create table 
Sql :: copy a table mysql 
Sql :: grant create db postgres 
Sql :: Add a new column into table 
Sql :: postgresql port 5432 not open 
Sql :: how to find max and min salary in sql 
Sql :: get current date sql 
Sql :: what is cursor in sql server with example 
Sql :: if else sql 
Sql :: how to find table lock and row lock in mysql 
Sql :: select only unique values from and to current table 
Sql :: sql vs nosql 
Sql :: install mysql 
Sql :: how to add new column with default value in sql server 
Sql :: mysql workbench download 
Sql :: querry mysql by 2 columns 
Sql :: Unable to locate package libmysql-java 
Sql :: oracle insert from select 
Sql :: sql track modification 
Sql :: greater than or equal to symbol in postgres 
Sql :: use of undefined constant mysql_assoc - assumed 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =