Database final document
Database final document
A. Combines the output from two queries and must include the same number of columns
B. Combines the output from multiple queries and must include the same number of
columns
C. Combines the output from multiple queries and does not have to include the same
number of columns
D. Combines the output from two queries and does not have to include the same number of
columns
Question 2: In the given query which of the keywords has to be inserted?
A. Value
B. Field
C. Relation
D. Table
Question 3: Which of the following relations is in Third normal form (3NF)?
A. R(ABCD) FD’s: AB -> C; BCD -> A; D -> A; B -> C
B. R(ABCD) FD’s: C -> B; B -> A; AC -> D; AC -> B
C. R(ABCD) FD’s: ACD -> B; AC -> D; D -> C; AC -> B
D. R(ABCD) FD’s: AB -> C; ABD -> C; ABC -> D; AC -> D
Question 4: Which of the following is NOT true about SQL Subqueries?
A. Subqueries are executed first.
B. None of these.
C. They are nested queries.
D. Only one subquery can be nested.
Question 5: This graphic indicates:
Select one:
A. a student cannot own a car.
B. That a student can own 0, 1 or many cars.
C. A car can be owned by many students
D. A student can own many cars and a car can be owned by many students.
Question 6: Which of the following statements is NOT true about subqueries?
A. Subqueries may occur in other places than the WHERE clause.
B. Subqueries can be added with an ORDER BY clause.
C. Subqueries cannot be nested multiple times
D. Subqueries can be used to compare an expression to the result of the query.
Question 7: Suppose relations R(A, B) and S(B, C, D) are as follows:
Compute the full outer join on B, the left outer join on B, and the right outer join on B. In each
case, R is the left operand and S is the right operand. Find the correct statement in the list
below.
A. The full outer join has 3 NULL’s
B. The full outer join has 6 tuples
C. The full outer join has 3 tuples
D. The full outer join has 2 NULL’s
Question 8: In ERD, what is the meaning of the rounded arrow?
A. One or many
B. Many
C. One and only one
D. One or Zero
Question 9: Supposed we have a table staffs containing the first and last name of all staffs in
USTH. Write a query to return find the official email of each person, given that the domain is
@usth.edu.vn and the mail is of the following format: [email protected]
A. SELECT first_name, last_name, concat(last_name, ‘.’, first_name, ‘@usth.edu.vn’) AS
Official_mail FROM Staffs
B. SELECT first_name, last_name, concat(last_name, ‘.’, first_name) AS Official_mail
FROM Staffs;
C. All of these are correct
D. SELECT first_name, last_name, distinct(first_name) AS Official_mail FROM Staffs;
Question 10: Supposed we have a table Employee that contains the id (emp_id),
name(emp_name) and working experience (experience) of each employee in a company. Write
a query to find the second employee in terms of experience in increasing order? (first being the
one with max experience).
A. SELECT emp_id, MAX(experience) AS second_max_exp FROM Employee WHERE
experience < (SELECT MAX(experience) FROM Employee);
B. All are correct
C. SELECT emp_id, experience AS second_max_exp FROM Employee WHERE
experience < (SELECT MAX(experience) FROM Employee);
D. SELECT emp_id, experience AS second_max_exp FROM Employee WHERE
experience > (SELECT MAX(experience) FROM Employee);
Question 11:
Name
Annie
Bob
Callie
Derek
Which of these queries will display the table given above?
A. Select employee
B. Select employee from name
C. Select name from employee
D. Select name
Question 12: Let R(ABCDEFGH) satisfy the following functional dependencies:
A -> B, CH -> A, B -> E, BD -> C, EG -> H, DE -> F.
Which of the following FD’s is also guaranteed to be satisfied by R?
A. BCD -> FH
B. ACG -> DH
C. CGH -> BF
D. ADG -> CH
Question 13: Consider the relation Courses(C, T, H, R, S, G), whose attributes may be thought
of information as course, teacher, hour, room, student and grade. Let the set of FD’s for
Courses be CàT, HR à C, HT à R, HS à R, and CS à G. Intuitively, the first says that a course
has a unique teacher, and the second says that only one course can meet in a given room at a
given hour. The third says that a teacher can be only one room at a given hour, and the fourth
says that the same about students. The last says that students get only one grade in a course.
A B C
1 2 3
4 2 3
4 5 6
2 5 3
1 2 6
Compute the projection 𝜋{𝐶,𝐵} (𝑅) and identify one of its tuples from the list below.
A. (5,3)
B. (2,5)
C. (6,5)
D. (1,2)
Question 15: Which keyword allows us to find the unique values in the database?
A. FIND
B. DIFF
C. DISTINCT
D. UNIQUE
Question 16: Which of the following is used to modify the data stored in the database?
A. UPDATE
B. SELECT
C. INSERT INTO
D. LIMIT
Question 17: Which of the following is not an aggregate function in SQL?
A. COUNT
B. AVG
C. SUM
D. FIND
Question 18: Data becomes ____ when it is presented in a format that people can understand
and use.
A. Information
B. Processed
C. Presentation
D. Graphs
Question 19: Consider the following data