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

PREVIOUS NEXT
Code Example
Sql :: date conversion in mysql column 
Sql :: windows services sql 
Sql :: sql date format 
Sql :: kill a pid redshift 
Sql :: mysql group by range 
Sql :: xampp import sql file command line 
Sql :: sql count number of rows after group by 
Sql :: oracle running queries sql 
Sql :: foreign key constraint in ms sql 
Sql :: mysql delete duplicate rows but keep one 
Sql :: ValueError: A string literal cannot contain NUL (0x00) characters. 
Sql :: encrypt password postgresql 
Sql :: rename table sql server 
Sql :: drop column from local database postgres pgadmin 
Sql :: how to enable extension in postgreSQL 
Sql :: how to inner join 4 tables in sql 
Sql :: change filed order in mysql 
Sql :: sql all 
Sql :: mssql dockere 
Sql :: mysql collation for all languages 
Sql :: mysql stored procedure vs function 
Sql :: PostgreSQL types and C# types 
Sql :: how to create external table in hive 
Sql :: mysql order by two columns priority 
Sql :: sql parent child tree query 
Sql :: change data type in mysql 
Sql :: mysql root permission denied lost 
Sql :: Save PL/pgSQL output from PostgreSQL to a CSV file 
Sql :: replace divide by zero error with 0 in sql 
Sql :: codeigniter get sql query string 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =