COMP7240 - Introduction to Database Concepts
Assignment 1: SQL
This assignment will be marked out of 20. It will count for 20% of the final grade. Below you will find 2 questions to reach this score.
Instructions:
You must submit two files: mydatabase.sql for Question 1 and myqueries.sql for Question 2 on Wattle before the due date. The template files are available in the folder “Assignment 1 ” on Wattle. You need to enter your answers into the template files, and ensure that the answers are executable as described below:
\i myqueries.sql ”.
Late submission is not granted under any circumstance. You will be marked on whatever you have submitted at the time of the deadline. Please take careful note of deadlines and adhere to them. Of course, if you find yourself in a situation beyond your control that you believe significantly affects an assessment, you should follow the ANU’s special consideration process.
Plagiarism will attract academic penalties in accordance with the ANU guidelines. A stu- dent in this course is expected to be able to explain and defend any submitted assessment item. The course convener can conduct or initiate an additional interview about any sub- mitted assessment item for any student. If there is a significant discrepancy between the two forms of assessment, it will be automatically treated as a case of suspected academic misconduct.
Good luck and enjoy the time you will spend on this assignment.
The IT Service of a university has designed the following database schema to manage rental contracts and transactions for its residents:
Contract(Building, RoomNo, UniID, StartDate, ContractNo, LengthInMonth, Month- lyRent)
Transaction(TranID, TransactionTime, Description, ContractNo, PaymentMethod, Amount)
Resident contains resident information and has the primary key UniID . Contract con- tains rental contracts with the primary key Building, RoomNo, UniID, StartDate . Con- tractNo contains contract numbers, which can uniquely identify each contract. Transaction contains credit/debit transactions on resident accounts (e.g., rental, miscellaneous payments, and returning deposit) and has the primary key {TranID}.
The template file mydatabase.sql contains the SQL statements which were designed by the IT Service to create this database. Your task is to answer the following questions by adding SQL statements into mydatabase.sql .
Note that, do not change or remove any existing SQL statements that were written in the template file and do not add your DROP TABLE statements into mydatabase.sql .
Consider the following relation schemas for a relational database moviedb:
Movie(title, production year, country, run time, major genre)
primary key: {title, production year}
Person(id, first name, last name, year born)
primary key: {id}
Director(id, title, production
For solution, connect with our online professionals.