Professional Documents
Culture Documents
DATA6211 Ea
DATA6211 Ea
Q.1.1 ____________exists when different versions of the same data appear separately in (1)
different places.
Q.1.3 Which of the following refers to something that can be identified in the users' work (1)
environment, something that the users want to track?
(1) Entity
(2) Attribute
(3) Identifier
(4) Relationship
Q.1.5 Multiplicity is the main constraint that exists on a relationship. Which two (2) (1)
constraints does it describe?
Q.1.6 An entity type whose existence depends on another entity type is called a (1)
_____ entity.
(1) Strong
(2) Weak
(3) Co-dependent
(4) Variant
Q.1.7 A category of SQL that includes commands to create database objects such as tables, (1)
indexes, and views.
(1) ANSI SQL.
(2) Data Definition Language.
(3) Structured Query Language.
(4) Data Manipulation Language.
Q.1.8 Which normal form would a table be in if it is in 2NF and contains no transitive (1)
dependencies?
(1) Selects all the fields from the Customer table for each row with a customer
labelled “best”
(2) Selects the “*” field from the Customer table for each row with a customer
labelled “best”
(3) Selects fields with a “*” in them from the Customer table
(4) Selects all the fields from the Customer table for each row with a customer
labelled “*”
Q.1.10 In SQL, which special operator is used to check whether a sub query returns any (1)
rows?
(1) DISTINCT
(2) UNIQUE
(3) NULL
(4) EXISTS
Q.2.1 Poorly designed databases usually pose a lot of challenges later in the operation of the (8)
business processes and transactions. Explain why database design is important?
Q.2.2 What is a relationship in context to tables in databases? What are the three types of (4)
relationships?
Q.2.3 Differentiate the following integrity rules, “Entity Integrity” and “Referential integrity”. (5)
Provide examples for each explanation.
Q.2.4 Students can reserve many books from the library per semester. The two entities are in (3)
a (* :*) relationship. Can many-to-many be implemented in a relational database?
Provide a reason for your answers.
Mark Allocation:
Entities 5 marks
Attributes (at least 2 per entity) 10 marks
Multiplicities 5 marks
Composite entity 1 mark
Primary keys 2 marks
Relationship names 5 marks
UML notation 2 marks
A purchase order can list many line items, but a given line item can be listed by only one
purchase order.
Purchases order details that can be considers are purchase order number, customer number,
order date, shipping date, street address, city.
A line item can refer to only one stock item, but a given stock item can be referred to by many
line items. The relationship is optional because zero line items might refer to a given stock
item.
Line item details can be as follows line item number, purchase order number, quantity and
discount.
Purchase order can contain many stock items, and a stock item can be contained in many
purchase orders.
Stock can be stock item number, description and price.
Customer can place many orders, but a given purchase order can be placed by only one
customer.
Customer details will contain the following, customer number, customer name , street address,
city and phone number.
Q.4.1 Explain the meaning of the following terms giving an example for each case. (6)
4.1.1 Attribute domain (2)
4.1.2 Single-valued attribute (2)
4.1.3 Multivalued attributes (2)
Q.4.2 What two conditions must be met before an entity can be classified as a weak entity? (4)
Give an example of a weak entity.
Q.5.1 The table shown below has not been normalized at all. Normalise the tables to third (15)
normal form (3NF). Show all steps in your normalisation, i.e. 1NF, 2NF and 3NF and the
resulting tables. Please label clearly those normal forms so that marks can be awarded
for each stage.
Mark Allocation:
First Normal Form (1NF) 4 marks
Table layout (1 Mark)
Step 1 (2 Marks)
Step 2 (1 Mark)
Second Normal Form (2NF) 5 marks
Third Normal Form (3NF) 6 marks
Q.5.2 Answer the following questions using the following table (5)
RESULTS TABLE( Student#, Subject_Code, Grade_Status)
a) Explain composite primary key of RESULTS TABLE (2)
b) Using the RESULTS TABLE above identify the two prime attributes and give a
reason for your answer (2)
c) Identify the non-prime attribute in the RESULTS TABLE (1)
SQL is a programming language used by database developers to query data. You are required to write
the SQL code when answering the following questions.
Patient table
PATIENTNUM NAME SURNAME APPOINTMENTDATE APPOINTMENTTIME SURGEONID
W220 TONY JONES 12 JUNE 2016 10:00 S10011
W223 TSHEPO MOKENA 01 JULY 2016 09:00 S10011
W225 PERCY MACKNA 12 JULY 2016 15:00 S10036
W224 JIMMY TAU 12 AUGUST 2016 14:00 S11006
Surgeon table
SURGEONID NAME AGE SALARY
S10011 ANA 35 12050
S10025 ANTONIO 45 90000
S10036 MARK 33 38000
S11006 MCCAIN 42 32500
Q.6.2 Write a SQL statement that will display patient’s name, appointment date and the (2)
appointment time and sorts only the column 'name' in ascending order.
Q.6.3 Write a SQL statement that will display all surgeons that have salary less than 35000 (3)
Q.6.4 You are required to delete a patient Tshepo Mokena using a relevant SQL statement (2)
Q.6.5 Write a SQL statement to count how many patients have booked appoints in total? (2)
Q.6.6 Write a SQL statement that will selects all patients with surnames that ends with the (3)
letter “A”.
Q.6.7 Add a new row in the Patient table with the following details (3)
Q.6.8 Write a query that will display the oldest surgeon. In your query display the following (3)
fields, name and age
Q.6.9 Write a query that determine the sum salary for all the surgeons. (2)
Q.6.10 Write an SQL statement that can be used to display name, age, and a new field called (5)
new salary showing a 15% increase in the salary. Display only those names where the
percentage increase in new salary is greater than 40000.
END OF PAPER