Minor edits during proofreading

This commit is contained in:
Anthony DeBarros 2021-09-25 08:35:49 -04:00
parent 14795ecd35
commit 0d72bde2b7
3 changed files with 15 additions and 10 deletions

View File

@ -133,6 +133,7 @@ FROM district_2020 LEFT JOIN district_2035
ON district_2020.id = district_2035.id ON district_2020.id = district_2035.id
WHERE district_2035.id IS NULL; WHERE district_2035.id IS NULL;
-- alternately, with a RIGHT JOIN
SELECT * SELECT *
FROM district_2020 RIGHT JOIN district_2035 FROM district_2020 RIGHT JOIN district_2035
ON district_2020.id = district_2035.id ON district_2020.id = district_2035.id

View File

@ -155,6 +155,10 @@ CREATE TABLE not_null_example (
CONSTRAINT student_id_key PRIMARY KEY (student_id) 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 -- Listing 8-11: Dropping and adding a primary key and a NOT NULL constraint
-- Drop -- Drop

View File

@ -306,7 +306,7 @@ GROUP BY state_name;
-- 1. According to the census population estimates, which county had the -- 1. According to the census population estimates, which county had the
-- greatest percentage loss of population between 2010 and 2019? Try -- 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.) -- to a particular type of facility.)
-- Answer: -- Answer:
@ -378,28 +378,28 @@ ON c2019.state_fips = c2010.state_fips
-- track of your vinyl LP collection. Start by reviewing these CREATE TABLE -- track of your vinyl LP collection. Start by reviewing these CREATE TABLE
-- statements. -- 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 ( CREATE TABLE albums (
album_id bigserial, album_id bigint GENERATED ALWAYS AS IDENTITY,
catalog_code varchar(100), catalog_code text,
title text, title text,
artist text, artist text,
release_date date, release_date date,
genre varchar(40), genre text,
description text description text
); );
CREATE TABLE songs ( CREATE TABLE songs (
song_id bigserial, song_id bigint GENERATED ALWAYS AS IDENTITY,
title text, title text,
composers text, composers text,
album_id bigint 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: -- Use the tables to answer these questions:
-- 1. Modify these CREATE TABLE statements to include primary and foreign keys -- 1. Modify these CREATE TABLE statements to include primary and foreign keys