INF2603 - 202 - 2021 Assignment 2
INF2603 - 202 - 2021 Assignment 2
Databases 1
INF2603
All Semesters
ASSIGNMENT 02
School of Computing
IMPORTANT INFORMATION:
This tutorial letter contains important information
about your module.
Assignment 02 ALL TOTAL MARKS: 100
681004 570719
Question 1 [28]
Question 2 [10]
a. What is the function of the WHERE clause in SQL? Which comparison operators can you
use in a WHERE clause? (4)
b. What is a computed column? How can you use one in an SQL query? How do you assign a
name to a computed column? (6)
Question 3 [16]
NOTE: All SQL syntax must be correct, missing characters will be penalized!
2.a. Given the structure and contents of the database shown in table below, use SQL
commands to answer questions 2.a.i-v.
2
INF2603/202
i. Write the SQL code that returns all the tuples with information on repayments from the
borrower with id equal to 61455, and where the lent amount exceeds R25 200.00. (4)
ii. Write the SQL code to change the loanamount of Mvelase to loanamount R6300. After you
have completed the changes, then reset the loanamount to the original amount loaned. (4)
iii. Write the SQL code that for each address finds the total repaid amount for the address. (4)
iv. Write the SQL code to delete table REPAYMENT from the database. (2)
v. What Oracle function should you use to calculate the number of days between date to
request a loan and the current date? (2)
Question 4 [21]
a. Define third normal form. What types of problems are associated with tables which are not in
in third normal form? (6)
b. Using your knowledge of the University environment, determine the functional or multivalued
dependencies that exist in the following table. After determining the functional
dependencies, convert this table to an equivalent collection of tables that are in 3rd normal
form.
Student (Student_Number, Student_Surname, Student_FName,Stud_Initial NumCredits,
AdvisorNum, Advisor_Surname, AdvisorName, Dept_Number, DeptName, (CourseNum,
CourseName, Semester, Level)) (15)
Suppose you are given the following business rules to form the basis for a database design.
The database must enable the organizer of a company internship training program to mail
invitations to the program’s interns, to plan the courses, to keep track of who attends the
trainings, and so on.
• Each training serves many interns, and each intern may attend many trainings.
• An intern receives many invitations, and each invitation is mailed to many interns.
• A training is based on a single course, but a course may be used as the basis for many
3
trainings. For example, a training maybe composed of Personal Development, Soft Skills,
and Mastering Communication in a Work Place courses. Or the training maybe composed
of Ethics, POPI Act, and Online Safety courses.
• An intern may attend many trainings, and each training may be attended by many interns.
Because the organizer is not a database expert, the first attempt at creating the database uses
the structure shown below:
Design the conceptual data model (ERD) in Crown’s Foot notation showing all entities,
relationships and cardinalities. Include the primary key and any foreign key representations in
your design.
UNISA 2021