This week we move on to databases, in particular PostgreSQL (aka Postgres). It is arguably the most powerful and versatile database available and knowing how to use it is almost certain to come in handy for anyone who works with data in their professional life.
Unfortuately, Postgres can be fussy to set up. So in preparation for this week's class, please follow the instructions in the week-4-postgis-setup.pptx document to install Postgres. You can verify that it is working properly by running postgis.r. If all goes smoothly, the whole process should only take a few minutes.
If you do run into problems setting up Postgres, please be sure to let me know.
Relational schema for a fictional UPenn Courses InTouch database
- RPostgreSQL: documentation
Using the fictional Courses InTouch database we worked with in class, write a single SQL query that returns the list of students who are qualified to graduate.
Due: 13-Feb-2018 before the start of class (optional)
For our fictional students to graduate, they must have completed at least 4 classes with a final grade of 80 or above.
Using the definition above, write a single SQL query that returns the list of all students that are cleared for graduation. This is possible using only the syntax we learned in class. There are also many other ways of achieving the same result using syntax that we did not cover, but can be found with a little investigation online.
Deliverable: just the SQL query, no need to send the full R script