1. Homepage
  2. Programming
  3. CSC343 Introduction to Databases - Assignment 2 - Warmup

CSC343 Introduction to Databases - Assignment 2 - Warmup

Engage in a Conversation
TorontoCSC343Introduction to DatabasesSQLPostgreSQL

Copyright (c) 2024 Jacqueline Smith & Marina Tawfik CourseNana.COM

University of Toronto CSC343, Fall 2024 CourseNana.COM

Assignment 2 Warmup CourseNana.COM

Due: Wednesday, October 9, before 4:00 p.m. CourseNana.COM

Learning Goals CourseNana.COM

This assignment aims to help you learn to: CourseNana.COM

run SQL code on a remote server
work with provided SQL starter code files write queries in SQL CourseNana.COM

Please read this assignment thoroughly before you proceed. Failure to follow instructions can affect your grade. CourseNana.COM

We will be testing your code in the CS Teaching Labs environment using PostgreSQL. It is your responsibility to make sure your code runs in this environment before the deadline! Code which works on your machine but not on the CS Teaching Labs will not receive credit. CourseNana.COM

This assignment is to be done individually. CourseNana.COM

The Domain CourseNana.COM

In this assignment, we will work with a database for a veterinary clinic, with a similar but not identical schema to the one you saw in Assignment 1. Keep in mind that your code for this assignment must work on any database instance (including ones with empty tables) that satisfies the schema. CourseNana.COM

All values of type time, timestamp etc. in the dataset provided are on a 24-hour clock. CourseNana.COM

Begin by getting familiar with the schema that we have provided vet warmup schema.ddl. You will work with a very similar schema on Assignment 2. CourseNana.COM

What to do General requirements CourseNana.COM

Since your code must run correctly on the Teaching Labs (dbsrv1, specifically), you will need to test your code there before you submit. We also suggest you do your work on the Teaching Labs, rather than installing PostgreSQL locally. To do that, you will need to have a process for working on a remote server. If you are not familiar with tools like ssh or scp, and other Unix-based command line tools, we recommend giving yourself some extra time to figure those out. Being able to use a command line text editor (e.g. vim, emacs, nano) will also be helpful. If you don’t know how to use one, we recommend choosing the one that the people around you use, so you can ask them questions and observe what they do. CourseNana.COM

This is an individual assignment, which means you should be able to work on a remote server yourself, and write and debug your own SQL queries. If you need help with using the command line and working on a remote server, it is OK to ask your classmates or friends for help with that, as long as you can do it yourself by the time you submit the assignment. If you need help with the queries, please ask the CSC343 course staff. There will be additional office hours added in advance of the assignment deadline. We expect that the queries are your own individual work, and no one else has helped you write or debug them. CourseNana.COM

CourseNana.COM

The schema and data CourseNana.COM

Copyright (c) 2024 Jacqueline Smith & Marina Tawfik CourseNana.COM

Included in the starter files is a file called vet warmup schema.ddl, which defines the schema for this assignment. We have also provided files in the data folder to populate the tables with data. CourseNana.COM

In order to be able to work on your queries, you will need to copy these files to dbsrv1 and use \i to import first the schema DDL file and then the data (import data.sql) into psql. You do NOT need to reload the data every time you open PostgreSQL; just remember to set your search path. The data is still there. CourseNana.COM

The queries CourseNana.COM

To ensure that your query results match the form expected by the auto-tester (attribute types and order, for instance), we are providing a schema for the result of each query. These can be found in files wu1.sql, wu2.sql, and wu3.sql. You must add your solution code for each query to the corresponding file. Make sure that each file is entirely self- contained, and not dependent on any other files; each will be run separately on a fresh database instance, and so (for example) any views you create in wu1.sql will not be accessible in wu3.sql. CourseNana.COM

Write SQL queries for each of the following: CourseNana.COM

  1. Find the procedure(s) that have been done by the most staff. Report the procedure ID(s), and the number of unique staff who have done that procedure. CourseNana.COM

  2. A “high-needs” patient is one that has had more than one and a half times the average number of appointments in the last calendar year (i.e., 2023). (Yes, the patient is included in the average.) Find the IDs of all high-needs patients and the number of appointments they have scheduled in 2024. CourseNana.COM

  3. A patient is considered “young” if they are under 3 years old, “senior” if they are over 8 years old, and “adult” otherwise. Their age should be calculated as of the current date. CourseNana.COM

    For each month of 2024, report the number of patients in each age category who had an appointment where they saw a vet (DVM). Include only those patients who saw in vet in 2024 in the results. CourseNana.COM

    As part of this query, you will need to take a look at the PostgreSQL documentation to learn about the command CAST. We have provided a type for you to use to represent the age category of a patient. You will also have to look at the documentation to learn how to work with dates in PostgreSQL. In particular, we expect EXTRACT will be helpful to you. CourseNana.COM

Submission instructions CourseNana.COM

For this assignment, you will hand in your three .sql files to MarkUs. Check that you have submitted the correct version of your file by downloading it from MarkUs. New files will not be accepted after the due date. Make sure that the files you submit run. This assignment will be autotested, and there will be no remarks. We will provide a checker for you to run that will confirm we can run your code, but it does not do thorough testing. You are responsible for testing your own code. CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Toronto代写,CSC343代写,Introduction to Databases代写,SQL代写,PostgreSQL代写,Toronto代编,CSC343代编,Introduction to Databases代编,SQL代编,PostgreSQL代编,Toronto代考,CSC343代考,Introduction to Databases代考,SQL代考,PostgreSQL代考,Torontohelp,CSC343help,Introduction to Databaseshelp,SQLhelp,PostgreSQLhelp,Toronto作业代写,CSC343作业代写,Introduction to Databases作业代写,SQL作业代写,PostgreSQL作业代写,Toronto编程代写,CSC343编程代写,Introduction to Databases编程代写,SQL编程代写,PostgreSQL编程代写,Torontoprogramming help,CSC343programming help,Introduction to Databasesprogramming help,SQLprogramming help,PostgreSQLprogramming help,Torontoassignment help,CSC343assignment help,Introduction to Databasesassignment help,SQLassignment help,PostgreSQLassignment help,Torontosolution,CSC343solution,Introduction to Databasessolution,SQLsolution,PostgreSQLsolution,