Learning Journal Week 2

 1.) One example where joining tables on something other than equality between keys is when another comparison needs to be considered as well. Our textbook has a good example. Suppose there is a table for students and another table for classes. We can join the two tables based on matching unique codes for classes in both tables AND another comparison to check if the student's grade is greater than the average grade for the class. An example of a query would be:

SELECT Student.name 

FROM Class 

INNER JOIN Student 

ON Student.grade > Class.average

AND Student.class_id = Class.class_id



2.) I feel SQL is pretty easy to pick up due to its similarity to spoken English. Sometimes when subqueries are nested it's a bit harder to figure out where the information is coming from, but views can be an alternative to simplify the syntax.

Comments

Popular posts from this blog

Module 4

Module 8

Module 3