Restaurant Analysis SQL project
- Julia Byers
- Mar 29, 2024
- 1 min read
Today I decided to put my refreshed SQL skills to use and complete the Restaurant Analysis guided project by Maven Analytics.
I started by downloading the files, connecting the database to the MySQL Workbench, and running the creation script.
First things first, I want to know what is in the tables (there are only 2), so I run the SELECT * for each table.
The menu_items table has the item number (primary key), item name, category, and price. I can easily see that there are four categories of food offered at the restaurant from a visual scan.
The order_details table has the order_details_id (primary key), an order id, date, time, and associated item_id (foreign key) . I can see that the difference between order_details_id and order_id is that each item ordered is a different detail_id, and some order_ids have multiple detail_ids, because orders may contain more than one item.
For the specific objectives, I commented in the questions and my answers directly into my SQL file.
Things I learned/was reminded of:
Don't forget your space after the dashes to signal a line of comment
THIS IS WHY WE PRACTICE
It's best to use the table containing transactional data as the left table. (Of course I had it backwards, using the menu_item table as the left table. When I switched it, however, and ran the queries again, my results were the same.)
Overall, I had only a few minor changes to make to my queries as I watched the solutions videos.

Комментарии