Skip to content

Instantly share code, notes, and snippets.

@ojles
Created September 12, 2018 13:26
Show Gist options
  • Select an option

  • Save ojles/6d7a2d1b637dfc0e73ef13b186990469 to your computer and use it in GitHub Desktop.

Select an option

Save ojles/6d7a2d1b637dfc0e73ef13b186990469 to your computer and use it in GitHub Desktop.
* ER diagrams
* create schema and insert some data
* postgresql domains
* constraints
* indexes
drop table if exists ad_agency;
drop table if exists customer;
drop table if exists advertisement;
drop table if exists ad_campaign;
create table ad_agency (
id serial primary key,
name varchar(100),
address varchar(150)
);
create table customer (
id serial primary key,
agency_id serial references ad_agency(id) on update cascade on delete cascade,
first_name varchar(50),
last_name varchar(50),
email varchar(254),
phone_number varchar(15)
);
create table ad_campaign (
id serial primary key,
description text,
create table advertisement (
id serial primary key,
description text,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment