Public
Edited
Aug 29, 2023
4 forks
Insert cell
Insert cell
Insert cell
db
CREATE SEQUENCE seq_person_id START 1
Insert cell
db
CREATE TABLE person(
person_id USMALLINT DEFAULT NEXTVAL('seq_person_id'),
fname VARCHAR(20),
lname VARCHAR(20),
eye_color CHAR(2),
birth_date DATE,
street VARCHAR(30),
city VARCHAR(20),
state VARCHAR(20),
country VARCHAR(20),
postal_code VARCHAR(20),
CONSTRAINT pk_person PRIMARY KEY(person_id)
);
Insert cell
db
INSERT INTO person
(fname,lname,eye_color,birth_date)
VALUES
('William','Turner','BR','1972-05-27');
Insert cell
db
INSERT INTO person
(fname,lname,eye_color,birth_date,street,city,state,country,postal_code)
VALUES
('Susan','Smith','BL','1975-11-02','23 Maple St.','Arlington','VA','USA','20220')
Insert cell
db
UPDATE person
SET
street = '1225 Tremont St.',
city = 'Boston',
state = 'MA',
country = 'USA',
postal_code = '02138'
WHERE person_id = 1;
Insert cell
Insert cell
db
CREATE TABLE favorite_food(
person_id USMALLINT,
food VARCHAR(20),
CONSTRAINT pk_fav_food PRIMARY KEY(person_id,food),
CONSTRAINT fk_fav_food_person FOREIGN KEY(person_id) REFERENCES person(person_id)
);
Insert cell
db
INSERT INTO favorite_food
(person_id,food)
VALUES
(1,'pizza'),
(1,'cookies'),
(1,'nachos');
Insert cell
db
DELETE FROM person
WHERE person_id = 2;
Insert cell
db
SELECT * FROM person;
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more