diff --git a/assign1.md~ b/assign2.md similarity index 60% rename from assign1.md~ rename to assign2.md index 47af13fe9f424279460f173820ce4ba8037ba4df..34d08b63266a9af791e65d81d68510cb6b432762 100644 --- a/assign1.md~ +++ b/assign2.md @@ -1,26 +1,25 @@ -## CMSC424 Fall 2022 Assignment 1: SQL -### Due Sep 11, 11:59pm. +## CMSC424 Fall 2023 Assignment 2: More SQL (v1.0) + + +### Due Sep 15, midnight. *The assignment is to be done by yourself.* -Download Assignment 1 <a href="https://sedna.cs.umd.edu/424/assign/assignment1Dist.tgz">here</a>. +Download Assignment 2 files <a href="https://sedna.cs.umd.edu/424/assign/assignment2Dist.tgz?2">here</a>. -The following assumes you have gone through PostgreSQL instructions and have ran some queries on the `university` database, -and have downloaded the above. The resulting files are: +The following assumes you have gone through PostgreSQL instructions +and have ran some queries on the `university` database, and have +downloaded the above distribution. The included files are: 1. populate.sql: The SQL script for creating the data. -1. queries.py: The file where to enter your answer -1. SQLTesting.py: File to be used for running the queries (in `queries.py`) against the database, and generate the file to be submitted. +1. queries.py: The file where to enter your answer and to upload to Gradescope. +1. SQLTesting.py: File to be used for running the queries (in `queries.py`) against the database. 1. Vagrantfile: A Vagrantfile that creates the `elections` database and populates it using `populate.sql` file. ### Getting started -Start the VM with `vagrant up` in the `assignment1Dist/` directory. The database should already be set up, but if not: +Start the VM with `vagrant up` in the `assignment2` directory. The database should already be set up, but if not: - Create a new database called `elections` and switch to it (see the PostgreSQL setup instructions). - Run `\i populate.sql` to create and populate the tables. -Note that as usual, you do not *have* to use Vagrant. However, it might make things easier for you. - -**NOTE:** You *can* use the VM you built in assignment0, but this Vagrantfile is slightly different. For example, some of the configured port forwarding is different, and several lines set up a new user and load in data for this assignment. You *can* just execute those commands in your current VM. - ### Schema The dataset contains results of `senate` and `presidential` elections for a subset of the years. For the `senate`, it contains only the statewide results from 1976 to 2018, whereas for the `presidential` elections, it contains county-level data going back to 2000. @@ -40,8 +39,8 @@ query and makes it easier to debug. You don't have to use the "hints" if you don't want to; there might be simpler ways to solve the questions. -### Testing and submitting using SQLTesting.py -Your answers (i.e., SQL queries) should be added to the `queries.py` file. A simple query is provided for the first answer to show you how it works. +### Testing with `SQLTesting.py` +Your answers (i.e., SQL queries) should be added to the `queries.py` file. Queries should be as in Assignment 1. You are also provided with a Python file `SQLTesting.py` for testing your answers. - We recommend that you use `psql` to design your queries, and then paste the queries to the `queries.py` file, and confirm it works. @@ -56,16 +55,17 @@ You are also provided with a Python file `SQLTesting.py` for testing your answer - **Note**: We will essentially run a modified version of `SQLTesting.py` that compares the returned answers against correct answers. So it imperative that `python3 SQLTesting.py` runs without errors. -### Notes/Errata -- Question #0 - Your solution should include `candidatename, partyname, candidatevotes` as the output columns. -- Question #4 - Your solution should assume the current year is **2020, not 2022**. -- Question #9 - Your solution should order by `countyname, statename ascending` . - -### Native Mac Instructions -You should be able to install postgresql w/ homebrew, as shown in Assignment 1. For this assignment you will need to submit queries from a python script (`SQLTesting.py`), which relies on `psycopg2`. Install via `sudo pip3 install psycopg2`. You will need to change the user `vagrant` to your username in `SQLTesting.py`. - ### Submission Instructions -Submit the `queries.py` file on Gradescope under <a href="https://www.gradescope.com/courses/424744/assignments/2209918">Assignment 1</a>. +Submit the `queries.py` file on Gradescope under <a href="https://www.gradescope.com/courses/424744/assignments/2184160">Assignment 2</a>. ### Assignment Questions -See `queries.py` file. +See `queries.py` file and the [updates/errata](#updateserrata) above. + + + +## Notes +- You can complete this assignment on the same VM as Assignment 1. Just copy over the +new `queries.py` and `SQLTesting.py` from the `assignment2` directory +- Execute `pip3 install ipython-sql` in order to use SQL from within Jupyter +notebooks. +