This assignment involved performing and verifying a series of SQL operations on a relational restaurant database (assign2db). The task covered:
- Data Updates
- Data Inserts
- Data Queries
- Views and Deletion with Referential Integrity
The assignment demonstrates proficiency in SQL including joins, nested queries, view creation, data manipulation, and handling foreign key constraints.
69_script2.sql: SQL script file containing all parts of the assignment.69_outputscript2.txt: Output captured from running the script on MySQL, including query results and errors.
- Changed dish name from “Pasta alla Brenda” to “Pasta alla Norma” and marked it vegetarian.
- Updated all orders delivered by Marge to have a delivery rating of 3.
- Added fictional characters:
Walter Whiteas a customerJesse Pinkmanas a driver- Favorite dish:
Los Pollos Hermanos Chicken
- Attempted to insert a new order which failed due to:
- Delivery address too long
- Foreign key constraint violation due to previous failure
Executed various SELECT queries to retrieve information such as:
- Driver and customer statistics
- Most popular vegetarian items
- Customers who only ordered vegetarian dishes
- Order costs
- Delivery durations
- Driver assignment gaps
- Created a view
driver_ordersto track deliveries. - Attempted deletion of drivers:
- Successfully deleted
D666(no associated orders) - Deletion of
D333failed due to referential integrity withcusordertable
- Successfully deleted
- Success: Most queries produced correct outputs; joins and subqueries were well-formed.
- Issue: The
cusorderinsertion failed due to an overly long address exceeding column limits. - Insight: Deleting drivers requires checking referential integrity constraints first.
To execute the script on MySQL:
mysql -u [username] -p < 69_script2.sqlMake sure the assign2db database is properly set up with required tables and constraints.
This submission is part of CS3319B – Introduction to Databases at Western University. For academic use only.