Tuesday, May 7, 2024

CST363 - Week 2

CST 363 Introduction to Database

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.   

One example of SQL-JOIN other than keys are the non-equijoin, cross-join, and self-join. In many cases these types of joins are helpful in tracking objects quantities, benchmarking, threshold control, or obtaining statistical data.

Take a look at this scenario. Imagine a retail store management wants to understand the effectiveness of a marketing campaign that offers discounts during specific months. The SQL join returns any month where the sales profit is larger than regular full price profit (Finance.Profit)


SELECT Month, Discount, Finance.Profit, Sales.SalesProfit

FROM Finance

Left Join Sales

ON SalesProfit > Finance.Profit;


2-In my opinion, SQL is easy to learn and use. The simplicity of its syntax and language flexibility provide a powerful avenue for retrieving meaningful data. One aspect that I sometimes find challenging to translate from English to SQL is the “most of” or “least of” in a multi-JOIN query. 


No comments:

Post a Comment

CST462S - Final Week

Service Learning Journal Reflections This marks the final week of our Service Learning experience. Our team successfully completed the final...