CST 363 Week 2
WELCOME TO WEEK 2
Learning Journal - SQL:
1. 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.
An example that I found is suppose we have two tables, 'customers' and 'stores', and we want to join them based on the location of the store and proximity of the customer to these stores. Lets say the state or even city.
The query sentence would be written as is: Join the customers table with the stores table based on proximity of customer addresses to store locations.
Query: select c.customer_id, c.customer_name, s.store_id, s.store_name from customers c cross join stores s where ST_distance(c.customer_location, s.store_location) < 1000;
2. 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?
I think SQL is fun to learn. However, at times it can be challenging when you are learning something new. But with more practice, it becomes very understandable. With time and practice, I am confident to do well with SQL. The most challenging part is often translating it. I often read the sentence multiple times in order to fully understand what it is asking.
Comments
Post a Comment