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 :: sql not start with vowel 
Sql :: Mysql Case sum 
Sql :: how to check port number for postgresql 
Sql :: tsql copy table 
Sql :: mac xampp mysql not starting 
Sql :: remove space in mysql 
Sql :: sql server: query to find out all the places where the table is used 
Sql :: mysql get first x characters 
Sql :: delete mysql from mac 
Sql :: mysql get longest string in column 
Sql :: drop table if exists in postgres 
Sql :: mysql server does not start mac 
Sql :: oracle sql drop index 
Sql :: created at and updated at in mysql 
Sql :: dump mysql 
Sql :: mysql check table exists 
Sql :: microsoft sql server extract hour and minute from datetime 
Sql :: postgres DROP and create contraint 
Sql :: name of today sql 
Sql :: postgresql if 0 then 1 
Sql :: import database in phpmyadmin command line 
Sql :: oracle cpu per session 
Sql :: how to check database engine in mysql 
Sql :: postgres drop column if exists 
Sql :: SQL select past number of days 
Sql :: Odoo Service is not coming up with postgresql read replica (slave) 
Sql :: pl sql dynamic sql drop doesnt work 
Sql :: pentaho + pasar de excel a sql 
Sql :: mysql column start with string 
Sql :: how to use a trigger to validate input data 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =