CST 363 - Week 2 - To Query or not to query, is that the question?

1. From my perspective, a useful example of joining on something other than keys would be to find events that happen in a period of time or specific date. For example, you might need to find all sales that happened during a holiday. This requires joining a Sales table not on an ID, but on a date range. In English, I'm asking the database to "Show me the sales for every sale whose date falls between a holidays start and end date." In SQL, I would write that as something like: SELECT s.SaleID ON s.SaleDate BETWEEN p.StartDate AND p.EndDate;

2. My opinion of SQL is that it's deceptively simple to start with—but very hard to master. I get lost when thinking about queries that require multiple levels of connections or operations. Something like "Find the average number of black cars per car in each state". Even if you had a giant DMV database it would require multiple subqueries or groupings and end up quite complex.

Comments

Popular posts from this blog

CST 300 - Week 2 - More than just a draft

CST 300 - Week 5 - Capstone and More

CST 300 - Week 4 - Writing With Purpose