Purpose:
You may make a copy of a activity-sql-basic.sql and complete this activity or type your queries directly in your database environment and export the .sql file later.
You may work alone or with 3-4 other students in this course (max size=5).
CREATE TABLE my_todo (id INT, task VARCHAR(20), priority VARCHAR(10), PRIMARY KEY (id));
INSERT INTO my_todo VALUES (99, "read book", "low"); INSERT INTO my_todo VALUES (101, 'do homework 2', "normal"); INSERT INTO my_todo VALUES (212, "write sql", "high"); INSERT INTO my_todo VALUES (114, "practice", "normal");
SELECT * FROM my_todo;
SELECT * FROM my_todo WHERE priority="high";
SELECT * FROM my_todo WHERE priority='normal';
SELECT task FROM my_todo WHERE priority="normal";
SELECT * FROM my_todo WHERE task LIKE "%sql" OR priority = "low";
SELECT DISTINCT * FROM my_todo;
SELECT DISTINCT priority, task FROM my_todo;
SELECT DISTINCT priority FROM my_todo;
UPDATE my_todo SET priority="low";
UPDATE my_todo SET priority="high" where task="write sql";
UPDATE my_todo SET priority="normal" where task="do homework 2";
DELETE FROM my_todo WHERE task="do homework 2";
DELETE FROM my_todo;
DROP TABLE my_todo;
Import alldbs.sql into your database server. Write SQL queries to solve the following problems. You will need to consider tables: loan, depositor, borrower, and account. (Sample data of these tables are also included at the end of this activity for your convenience)
Released under the CC-BY-NC-SA 4.0 license.
Last updated 2024-02-13 8:26