HOUR OF DATABASES
KHAN ACADEMY
CHALLENGE: BOOK LIST DATABASE
How do I create a table list using SQL code?
Learning Target: My learning target is to create a table listing and rating books using HTML code. I will know that I have met my learning target if I am able to use the correct rules of SQL to create and rate a data table about books.
Learning Target: My learning target is to create a table listing and rating books using HTML code. I will know that I have met my learning target if I am able to use the correct rules of SQL to create and rate a data table about books.
CREATE TABLE Books (ID INTEGER PRIMARY KEY, Name TEXT, Rating INTEGER);
INSERT INTO Books VALUES (1, "Matched", 7);
INSERT INTO Books VALUES (2, "Crossed", 9);
INSERT INTO Books VALUES (3, "Reached", 10);
SELECT * FROM Books;
CHALLENGE: BOX OFFICE HITS DATABASES
How do I query a movie database in different ways?
Learning Target: My learning target is to query a movie database in different ways. I will know that I have met my learning target if I am able to use my SQL skills to query a movie database in different ways.
Learning Target: My learning target is to query a movie database in different ways. I will know that I have met my learning target if I am able to use my SQL skills to query a movie database in different ways.
CREATE TABLE movies (id INTEGER PRIMARY KEY, name TEXT, release_year INTEGER);
INSERT INTO movies VALUES (1, "Avatar", 2009);
INSERT INTO movies VALUES (2, "Titanic", 1997);
INSERT INTO movies VALUES (3, "Star Wars: Episode IV - A New Hope", 1977);
INSERT INTO movies VALUES (4, "Shrek 2", 2004);
INSERT INTO movies VALUES (5, "The Lion King", 1994);
INSERT INTO movies VALUES (6, "Disney's Up", 2009);
SELECT * FROM movies;
SELECT * FROM movies WHERE release_year >2000
CHALLENGE: TODO LIST DATABASE STATS
How do I query statistics from a TODO list?
Learning Target: My learning target is to query statistics from a TODO list. I will know that I have met my learning target if I am able to my SQL skills and rules to query statistics.
Learning Target: My learning target is to query statistics from a TODO list. I will know that I have met my learning target if I am able to my SQL skills and rules to query statistics.
CREATE TABLE todo_list (id INTEGER PRIMARY KEY, item TEXT, minutes INTEGER);
INSERT INTO todo_list VALUES (1, "Wash the dishes", 15);
INSERT INTO todo_list VALUES (2, "vacuuming", 20);
INSERT INTO todo_list VALUES (3, "Learn some stuff on KA", 30);
INSERT INTO todo_list VALUES (4, "Clean the room", 15);
SELECT SUM (minutes) FROM todo_list
PROJECT: DESIGN A STORE DATABASE
How do I design a store database?
Learning Target: My learning target is to create a store database. I will know that I have met my learning target if I am able to use the SQL rules correctly to create a store database.
Learning Target: My learning target is to create a store database. I will know that I have met my learning target if I am able to use the SQL rules correctly to create a store database.
CREATE TABLE Fruits (ID INTEGER PRIMARY KEY, Name TEXT, Price INTEGER, Aisle INTEGER, Color TEXT);
INSERT INTO Fruits VALUES (1, "Bananas", 2, 4, "Yellow");
INSERT INTO Fruits VALUES (2, "Apples", 1, 4, "Red");
INSERT INTO Fruits VALUES (3, "Watermelons", 5, 5, "Red");
INSERT INTO Fruits VALUES (4, "Strawberries", 3, 3, "Red");
INSERT INTO Fruits VALUES (5, "Blueberries", 3, 3, "Blue");
INSERT INTO Fruits VALUES (6, "Blackberries", 3, 3, "Black");
INSERT INTO Fruits VALUES (7, "Oranges", 1, 4, "Orange");
INSERT INTO Fruits VALUES (8, "Mangoes", 4, 5, "Orange");
INSERT INTO Fruits VALUES (9, "Pineapples", 4, 5, "Yellow");
INSERT INTO Fruits VALUES (10, "Pears", 1, 4, "Green");
INSERT INTO Fruits VALUES (11, "Peaches", 2, 4, "Orange");
INSERT INTO Fruits VALUES (12, "Raspberries", 3, 3, "Red");
INSERT INTO Fruits VALUES (13, "Grapes", 2, 3, "Purple");
INSERT INTO Fruits VALUES (14, "Kiwi", 3, 3, "Green");
INSERT INTO Fruits VALUES (15, "Pomegranate", 5, 5, "Red");
SELECT * FROM Fruits ORDER BY Price;
SELECT MAX(price) FROM Fruits