INF2603 October November 2024
INF2603 October November 2024
INF2603 October November 2024
OCTOBER/NOVEMBER 2024
INF2603
Database 1
100 Marks
Duration 2 Hours
EXAMINERS:
FIRST: Mr ME Bogopa
SECOND: Mrs CL Hlengwa
Instructions:
GOOD LUCK.
2
INF2603
OCTOBER/NOVEMBER 2024
For question 1 to 5: Indicate whether the statement is true or false. (2 marks each):
3. If Capricon TVET College had some departments that were classified as “research
only,” they would not offer courses; therefore, the COURSE entity would be
independent to the DEPARTMENT entity.
a. True
b. False
TURN OVER
3
INF2603
OCTOBER/NOVEMBER 2024
For question 6 to 10: Identify the choice that best completes the statement or answer the
question. (2 marks each):
a. CHECK
b. HAVING
c. EXISTS
d. UPDATE
e. LIKE
6. Validates data in an attribute.
7. Checks whether a subquery returns any rows.
8. Restricts the selection of grouped rows based on a condition.
9. Modifies an attribute’s values in one or more table’s rows.
10. Checks whether an attribute value matches a given string pattern
TURN OVER
4
INF2603
OCTOBER/NOVEMBER 2024
a. What is the difference between a column constraint and a table constraint? (4)
c. What three join types are included in the OUTER JOIN classification? (6)
e. Why is a table whose primary key consists of a single attribute automatically in 2NF
when it is in 1NF? (2)
UniBo database stores information about students, courses, and enrolments. Initially, the
data might be stored in a single table like this:
Using the following transport business rules, draw the appropriate ERD using UML
notation for a unique e-hailing taxi service in Mpumalanga. Make sure that you include
all appropriate entities, relationships, and multiplicities:
• One driver can be assigned to multiple taxis over time, but each taxi has only one
driver at a time
• Each customer can have multiple rides, and the e-hailing services offer sharing
options for the customers
• Each ride has one payment, and the customer can decide to cancel and the
payment will be reversed
NOTE: All SQL syntax must be correct, missing characters will be penalized!
Given the structure and contents of the database shown in table above, use SQL
commands to answer questions 5.a.i-ii.
TURN OVER
6
INF2603
OCTOBER/NOVEMBER 2024
i. Write a SQL code to display the employees names, year of birth, and the bonus for
each employee. Sort the results by the employee_id as in the table below. (5)
Table 5.1:
ii. Write the SQL code to delete the row for the employee who was paid R24,000 bonus.
(2)
5.b. In the following questions, you will use the data of UNISA student registration
information.
i. Write the SQL code that will create the STUDENT table provided below. This
table is a subset of the UNISA student registration database. (Note that the
DEPT_CODE is the FK to DEPARTMENT, also use your own Data
Declarations). (4)
STUDENT
StudentID {PK}
DEPT_CODE {FK}
STUD_Gender
STUD_fname
STUD_lname
STUD_INITIAL
STUD_EMAIL
ii. Because you are a registered student at UNISA and you have classmates who
are your friends, please write SQL code to enter your own correct information
and also the information of anther student into the STUDENT table. That is 2
records. For the student number of your friend you can use 33339999. (4)
TURN OVER
7
INF2603
OCTOBER/NOVEMBER 2024
iii. Write a SQL code to change your email address from your mylife email
address to a Gmail address. (3)
iv. Write a SQL code to delete the STUDENT table from the database. (2)
©
UNISA 2024
TURN OVER