Professional Documents
Culture Documents
PRIME
3. A(n) ___ exists when there are functional dependencies such that WZ is functionally
dependent on XY, W is functionally dependent on X, and XY is the primary key
PARTIAL DEPENDENCY
4. A(n) exists when there are functional dependencies such the Y is functionally dependent
on X, Z is functionally dependent on Y and X is the primary key
TRANSITIVE DEPENDENCY
5. A ___ derives its name from the fact that a collection of multiple entries of the same
type can exist for any single key attribute occurrence
REPEATING GROUPS
7. Dependencies based on only a part of a composite primary key are known as ___
dependencies
PARTIAL
3NF
9. The SQL command that allows a user to permanently save data changes is ___
COMMIT
10. The SQL command that allows a user to list the contents of a table is ___
SELECT
11. The ___ command is used to restore the database to its previous condition
ROLLBACK;
12. The ___ command would be used to delete the table row where the P_CODE is ‘BRT-
345’
13. Which of the following queries will output the table contents when the value of V_CODE
is equal to 21344?
14. Which of the following queries will use the given columns and column aliases from the
PRODUCT table to determine the total value of inventory held on hand?
15. Which of the following queries uses the correct SQL syntax to list the table contents for
either V_CODE = 21344 or V_CODE = 24288?
16. The special operator used to check whether an attribute value is within a range of values
is __
BETWEEN
17. Which of the following queries will output the table contents when the value V_CODE is
NOT equal to 21344?
18. The SQL query to output the contents of the EMPLOYEE table sorted by last name, first
name, and initial is ___
SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE FROM
EMPLOYEE ORDER BY EMP_LNAME, EMP_FNAME, EMP_INITIAL;
19. A table can be deleted from the database by using the ___ command
DROP TABLE
20. The query to join the P_DESCRIPT and P_PRICE fields from the PRODUCT table and the
V_NAME, V_AREACODE, V_PHONE and V_CONTACT fields from the VENDOR table,
where the values of V_CODE match and the output is ordered by the price is ___
21. A database language enables the user to perform complex queries designed to
transform the raw data into useful information
TRUE
22. Entity integrity is enforced automatically when the primary key is specified in the
CREATE TABLE command sequence
TRUE
INSERT INTO EMP_1 VALUES (‘101’, ‘News’, ‘John’, ‘G’, ’08-Nov-00’, ‘502’);
ii. Assuming the data shown in the EMP_1 table been entered write the SQL code
that will list all attributes for a job code of 502
SELECT JOB_CODE
FROM EMP_1
WHERE JOB_CODE = ‘502’;
iii. What would be the output of executing the on the SQL code you write in
question ii. Note that query is valid
ii. Write the SQL code to display the average purchases of the customers
iii. What should be the output of executing the following query on table invoice?
Note that query is valid
SELECT INV_NUMBER, UNITS_BOUGHT, UNIT_PRICE, SUBTOTAL
FROM INVOICE
WHERE SUBTOTAL BETWEEN 4.99 and 14.97
AND UNITS_BOUGHT > = 2;
25. Considering the ER model and tables given below, answer to the following questions
Departments is one and employees is many
Department tubules record
Employee tubules record
Indicate for each following expression whether it is valid SQL statement or not. A valid
query complies with SQL syntax and doesn’t result its error when executed. Use the
below table for your answer
a. INSERT INTO departments (department_id, department_name) VALUES (NULL, ‘IT
Test’);
b. INSERT INTO employees (last_name, department_id, employee_id) VALUES (‘Taylor’,
60, 110);
c. INSERT INTO employees (employee_id, last_name, department_id) VALUES (108,
‘Smith’, NULL);
d. UPDATE employees SET employees_id = 100;
e. UPDATE employees SET last_name = ‘John’ where employee_id = 107;
ANSWER
A is invalid
B is valid
C is invalid
D is invalid
E is valid
26. Decompose the following dependency diagram to tables in 3NF (third normal form)
Note: this dependency diagram is about medicine prescription given by a doctor to a
patient
Medname is primary key, patientID is primary key, date primary key, refillsallowed,
patientname, dosage, shelflife
1NF
2NF
T1 = medname, shelflife
T2= patientID, patientname
T3 = medname, patientid, date, refillallowed, dosage
3NF
T1 = medname, shelflife
T2= patientid, patientname
T3 = medname, patientid, date, refillallowed, dosage
(there is no transitive dependency)