Uploaded by Desire Mdlovu

INF2603 202 2021 Assignment 2

advertisement
INF2603/202/0/2021
Tutorial letter 202/0/2021
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
Due date
Tutorial matter covered in prescribed book
14 July 2021
All chapters in the syllabus
Unique numbers
Semester 1
Semester 2
681004
570719
Question 1
[28]
a. What is redundancy? What problems are associated with redundancy?
(4)
b. What is a relationship? Explain what is one-to-many relationship?
(4)
c. Explain what is an E-R diagram?
(2)
d. What is database design?
(2)
e. Use examples to compare and contrast structured and unstructured data. Which type is
more prevalent in a typical business environment?
(6)
f. Define and describe the basic characteristics of a NoSQL database.
(10)
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?
Question 3
(6)
[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.
REPAYMENT (borrower_id, name, address, loanamount, requestdate, repayment_date,
repayment_amount)
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.
ii.
(4)
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.
v.
What Oracle function should you use to calculate the number of days between date to
(2)
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,
Student_Initial,
NumCredits, AdvisorNum, Advisor_Surname, AdvisorName, Dept_Number, DeptName,
(CourseNum, CourseName, Semester, Level))
QUESTION 5
(15)
[25 marks]
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:
Sample TRAINING records:
Attribute Name
INTERN_NUM
INTERN_NAME
INTERN_ROLE
INTERN_EMAIL
INVITE_NUM
INVITE_DATE
ACCEPT_DATE
TRAINING_DATE
TRAINING_ATTENED
TRAINING_CODE
TRAINING_DESCRIPTION
Sample Value
I117
John Mahlangu
Junior Developer
johnm@ola.com
3
21-Jan-2020
29-Jan-2020
10-Feb-2020
Yes
T101
Orient interns about
personal development
at work
Sample Value
I305
Cindy Jacobs
Associate Risk Analyst
cindyj@ola.com
51
7-May-2020
7-May-2020
16-Aug-2020
No
T771
Compliance and how it
affects the company
COURSE_CODE
COURSE_NAME
PD101
Introduction to
Personal Development
CERTIFICATE_NUM
CERTIFICATE_TITLE
127324
Personal Mastery
ISSUE_DATE
10-Feb-2020
COM101
Mastering
Communication in a
Work Place: Part 1
413487
Communicator at
Work
01-Sep-2020
Sample Value
I721
Themba Smith
Data Capturer
thembas@ola.com
7
12-Apr-2020
10-May-2020
21-May-2020
Yes
T555
Staying safe while
using the company
resources on the
internet
E100
Ethics
138746
Ethics Knowledge
21-May-2020
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
4
Download