diff --git a/lsqlthw-remnants/.gitignore b/lsqlthw-remnants/.gitignore new file mode 100644 index 0000000..98e6ef6 --- /dev/null +++ b/lsqlthw-remnants/.gitignore @@ -0,0 +1 @@ +*.db diff --git a/lsqlthw-remnants/ex1.sql b/lsqlthw-remnants/ex1.sql new file mode 100644 index 0000000..a11c388 --- /dev/null +++ b/lsqlthw-remnants/ex1.sql @@ -0,0 +1,6 @@ +CREATE TABLE person ( + id INTEGER PRIMARY KEY, + first_name TEXT, + last_name TEXT, + age INTEGER +); diff --git a/lsqlthw-remnants/ex2.sql b/lsqlthw-remnants/ex2.sql new file mode 100644 index 0000000..48a85a9 --- /dev/null +++ b/lsqlthw-remnants/ex2.sql @@ -0,0 +1,19 @@ +CREATE TABLE person ( + id INTEGER PRIMARY KEY, + first_name TEXT, + last_name TEXT, + age INTEGER +); + +CREATE TABLE pet ( + id INTEGER PRIMARY KEY, + name TEXT, + breed TEXT, + age INTEGER, + dead INTEGER +); + +CREATE TABLE person_pet ( + person_id INTEGER, + pet_id INTEGER +); diff --git a/lsqlthw-remnants/ex3-myself.sql b/lsqlthw-remnants/ex3-myself.sql new file mode 100644 index 0000000..391d32f --- /dev/null +++ b/lsqlthw-remnants/ex3-myself.sql @@ -0,0 +1,8 @@ +INSERT INTO person (id, first_name, last_name, age) + VALUES (1, "Dan", "Buch", 31); + +INSERT INTO pet (id, name, breed, age, dead) + VALUES (2, "Franny", "Dog", 14, 0); + +INSERT INTO pet (id, name, breed, age, dead) + VALUES (3, "Zooey", "Cat", 7, 0); diff --git a/lsqlthw-remnants/ex3.sql b/lsqlthw-remnants/ex3.sql new file mode 100644 index 0000000..0c14ca2 --- /dev/null +++ b/lsqlthw-remnants/ex3.sql @@ -0,0 +1,7 @@ +INSERT INTO person (id, first_name, last_name, age) + VALUES (0, "Zed", "Shaw", 37); + +INSERT INTO pet (id, name, breed, age, dead) + VALUES (0, "Fluffy", "Unicorn", 1000, 0); + +INSERT INTO pet VALUES (1, "Gigantor", "Robot", 1, 1); diff --git a/lsqlthw-remnants/ex4-myself.sql b/lsqlthw-remnants/ex4-myself.sql new file mode 100644 index 0000000..432b133 --- /dev/null +++ b/lsqlthw-remnants/ex4-myself.sql @@ -0,0 +1,5 @@ +INSERT INTO person_pet (person_id, pet_id) + VALUES (1, 2); + +INSERT INTO person_pet (person_id, pet_id) + VALUES (1, 3); diff --git a/lsqlthw-remnants/ex4.sql b/lsqlthw-remnants/ex4.sql new file mode 100644 index 0000000..5d5eb14 --- /dev/null +++ b/lsqlthw-remnants/ex4.sql @@ -0,0 +1,2 @@ +INSERT INTO person_pet (person_id, pet_id) VALUES (0, 0); +INSERT INTO person_pet VALUES (0, 1); diff --git a/lsqlthw-remnants/ex5.sql b/lsqlthw-remnants/ex5.sql new file mode 100644 index 0000000..0839fcf --- /dev/null +++ b/lsqlthw-remnants/ex5.sql @@ -0,0 +1,7 @@ +SELECT * FROM person; + +SELECT name, age FROM pet; + +SELECT name, age FROM pet WHERE dead = 0; + +SELECT * FROM person WHERE first_name != "Zed";