CST 363 - Week 2

 

SQL has the flexibility to join tables on any column(s) using any predicate (=, >, < ).    Most of the time the join will use equality between a primary and foreign key.   Think of example where joining on something other than keys would be needed.  Write the query both as an English sentence and in SQL.  If you can't think of your own example, search the textbook or internet for an example.

SELECT 
FROM table1
LEFT JOIN table2
ON table1.column = table2.column;

The above is a basic example of a left join that would the first table with the table2. They are joined on matching column values and are equal due to the = operator, however different operators can be used to join these tables as necessary. This example was taken from https://learnsql.com/blog/left-join-examples/  

What is your opinion of SQL as a language?  Do you think it is easy to learn and use?  When translating from an English question to SQL, what kinds of questions do you find most challenging?

SQL as a language is pretty straight forward, however there are some complexities that come with it. It can be difficult at times to create a precise statement that includes everything that is needed from a table. It's not necessarily easy, but it's also not too difficult once you begin recognizing what to use and how to structure certain queries. The most challenging portion would be making sure that certain output is correct based on the query and what is being asked. Hints are helpful, but when they're not available sometimes it's difficult to confirm if you're providing the correct response. 

Comments

Popular Posts