HW3: Intermediate SQL
Due: Tuesday, Oct 7th
Image source:
postgresql.org
This is the second of three SQL query assignments. You are given 8 queries to write, along with the expected output. Use pgAdmin to write and test the queries. Be sure to start early—this assignment might take longer than you think.
Objectives¶
- Write queries that use
GROUP BY
,HAVING
, andLIKE
. - Write queries that include outer joins and function calls.
Instructions¶
-
Download the provided template. Read and follow the instructions at the top of the file.
-
Download the solution's output. This is the output that your final queries should produce.
The Transaction Processing Performance Council (TPC) is a non-profit organization founded in 1998 that develops performance benchmarks for database systems. One of the benchmarks, TPC-H, simulates a business-oriented database with customers and suppliers. Refer to the TPC-H Schema for more details.
Note: Your SQL file should run without any errors and finish in under two minutes. If any query is taking longer than 15 seconds, you are probably doing something wrong.
Autograder Script – optional, but recommended
Download the autograder script. Gradescope will use this script to test your submission.
- Run
hw3.py
(the autograder script) in the same folder ashw3.sql
andhw3-sol.txt
. - If you have trouble getting the script to run, we can help you in class or office hours.
- Or you can just submit to Gradescope over and over, and the same script will run.
- We're giving you the autograder script so you don't have to submit so many times.
Submission¶
Submit your hw3.sql
to the HW3 assignment on Gradescope.
Your code will first be graded by Gradescope and then by the professor. The grade you receive from Gradescope is the maximum grade that you can receive on the assignment.
After the due date, the professor may manually review your code. At that time, points may be deducted for inelegant code, inappropriate variable names, bad comments, etc.
Gradescope will provide you with hints but might not completely identify the defects in your submission. You are expected to test your own code before submitting.
There is no limit on the number of submissions and no penalty for excessive submissions. Points will be allocated as follows:
Criterion | Points | Details |
---|---|---|
Autograder | 80 pts | Partial Credit Possible |
Code Review | 20 pts | Partial Credit Possible |
The code review will include:
- The approach you took on each query (10 pts).
- Style and formatting of the SQL code (10 pts).