Minor edits during proofreading
This commit is contained in:
parent
14795ecd35
commit
0d72bde2b7
@ -133,6 +133,7 @@ FROM district_2020 LEFT JOIN district_2035
|
||||
ON district_2020.id = district_2035.id
|
||||
WHERE district_2035.id IS NULL;
|
||||
|
||||
-- alternately, with a RIGHT JOIN
|
||||
SELECT *
|
||||
FROM district_2020 RIGHT JOIN district_2035
|
||||
ON district_2020.id = district_2035.id
|
||||
|
||||
@ -155,6 +155,10 @@ CREATE TABLE not_null_example (
|
||||
CONSTRAINT student_id_key PRIMARY KEY (student_id)
|
||||
);
|
||||
|
||||
-- This will fail:
|
||||
INSERT INTO not_null_example (first_name, last_name)
|
||||
VALUES ('Sting', NULL);
|
||||
|
||||
-- Listing 8-11: Dropping and adding a primary key and a NOT NULL constraint
|
||||
|
||||
-- Drop
|
||||
|
||||
@ -306,7 +306,7 @@ GROUP BY state_name;
|
||||
|
||||
-- 1. According to the census population estimates, which county had the
|
||||
-- greatest percentage loss of population between 2010 and 2019? Try
|
||||
-- an internet search to find out what happened. (Hint: The loss is related
|
||||
-- an internet search to find out what happened. (Hint: The decrease is related
|
||||
-- to a particular type of facility.)
|
||||
|
||||
-- Answer:
|
||||
@ -378,28 +378,28 @@ ON c2019.state_fips = c2010.state_fips
|
||||
-- track of your vinyl LP collection. Start by reviewing these CREATE TABLE
|
||||
-- statements.
|
||||
|
||||
-- The albums table includes information specific to the overall collection
|
||||
-- of songs on the disc. The songs table catalogs each track on the album.
|
||||
-- Each song has a title and a column for its composers, who might be
|
||||
-- different than the album artist.
|
||||
|
||||
CREATE TABLE albums (
|
||||
album_id bigserial,
|
||||
catalog_code varchar(100),
|
||||
album_id bigint GENERATED ALWAYS AS IDENTITY,
|
||||
catalog_code text,
|
||||
title text,
|
||||
artist text,
|
||||
release_date date,
|
||||
genre varchar(40),
|
||||
genre text,
|
||||
description text
|
||||
);
|
||||
|
||||
CREATE TABLE songs (
|
||||
song_id bigserial,
|
||||
song_id bigint GENERATED ALWAYS AS IDENTITY,
|
||||
title text,
|
||||
composers text,
|
||||
album_id bigint
|
||||
);
|
||||
|
||||
-- The albums table includes information specific to the overall collection
|
||||
-- of songs on the disc. The songs table catalogs each track on the album.
|
||||
-- Each song has a title and a column for its composers, who might be
|
||||
-- different than the album artist.
|
||||
|
||||
-- Use the tables to answer these questions:
|
||||
|
||||
-- 1. Modify these CREATE TABLE statements to include primary and foreign keys
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user