More SQL Queries
The homework for SQL Queries were actually pretty fun. Like I wrote in my previous entry, figuring out the queries and how to get the information you want from the databases is a lot like plotting a route in a maze. You look at tables and see what information they have and you look at the relationships to help you determine your starting point and your ending point.
Unfortunately for me, I always get screwed on easy questions because of a small thing that I overlooked. The question was write a query that will return all movies that are in the drama genre and has a rental rate of 2.99. Seems pretty straight forward, and I saw in the ERDs that I'm going to be joining quite a bit of tables to get my answer (shown below).
I would go from categories table all the way to the payment table. Or so I thought. The film table actually has a rental rate column that I overlooked. Which led to me scratching my head and doubting my confidence in my joining abilities.
I don't like looking at the answer sheet unless I am truly stuck. But after spending an hour trying to figure out where I go wrong, I gave in and realized how dumb my mistake was.
This just goes to show how merciless databases can really be. Or that I need better vision.
Anyways, I only had enough time to finish the mandatory SQL assignments. I plan on going back to it this weekend when I have time.
No comments:
Post a Comment