Learning Journal Week 2 - databases

 

  • SQL can join tables in more ways than just matching primary and foreign keys. For example, in these recent labs, with the small courses database, we created a view for the average salary in each department. After that, we joined the instructor table with the view to see which instructors earn more than the average salary in their department. In English, the query is: find the instructors whose salary is greater than the average salary for their department. In SQL, the query is:

SELECT i.name, i.dept_name, i.salary FROM instructor i JOIN dept_summary d USING (dept_name) WHERE i.salary > d.average_salary;

This shows how joins can use a condition like “greater than” instead of just matching keys.

  • I think SQL is easier to learn compared to Java work. It feels closer to English, and when I run a query, I can see right away if I did it right. The harder part is when the question involves grouping or subqueries, because it takes me a little longer to set those up. The most challenging aspect overall hasn’t been SQL, but rather the Java homework, especially Lab 10, where I had to mix Lab 4 and Lab 8 to make them work in harmony. That was tough, while SQL feels more direct. I like how running queries provides me with quick feedback and helps me learn by trying.

Comments

Popular posts from this blog

Week 2 Learning Journal Post

Industry Expert Interview – Exploring Career Paths and Industry Trends

Week 4 Learning Journal