The purpose of this lab will be to create two tables and insert some sample
data to get some experience with various constraints. You'll be using psql
as your PostgreSQL client. Try the following activities answering
all the questions. Turn in the files with your table creations as well as
your written answers.
Flavors with the following schema:
It may take a few tries to get the syntax down, so create the SQL
statement in a text file and use \i <file> in psql
to execute it.
People with the following schema:
Use \i again.
SELECT * FROM <table_name>;You'll need this to examine the results of your experiments.
People:
INSERT INTO People (Name, IceCream) VALUES ('Tom', 'Mint');
What happened? Why?
Flavors:
INSERT INTO Flavors VALUES ('Mint', 'Bittersweet Mint', 'PSU',
'The best flavor in the whole world.');
What's the syntax difference between this insert and the previous insert?
Why the variants? Code and Name
attributes into Flavors. SoldBy attribute of 'DQ'.
Descr. People with a missing Age.
DROP TABLE People; DROP TABLE Flavors;
Use\qto exitpsql.