lOMoARcPSD|34971675
DBS- Midterm
Database System (Đại học Hà Nội)
Scan to open on Studeersnel
Studocu is not sponsored or endorsed by any college or university
Downloaded by Bách Nguy?n Th? (
[email protected])
lOMoARcPSD|34971675
MIDTERM – DATABASE
1. If "ASC" keyword is omitted in ORDER BY query, then sorting mode is?
A. Ascending
B. Descending
C. No sorting mode applied
D. Error in Sql query
2. What is the correct answer for Horizontal parititioning?
A. Is the technique to divide records in a table into several separate smaller tables
B. Is a technique to divide fields in a table into several separate smaller tables
C. Is the combination of both technique
D. None above is correct
3. Which of the following is the correct INSERT statement, given Customer table has 2
fields: customer_id, name?
A. INSERT INTO Customer VALUES (customer_id = 1, name = 'camnh')
B. INSERT INTO Customer(customer_id, name) VALUE (1, 'camnh'))
C. INSERT INTO Customer VALUES (1, 'camnh')
D. INSERT (1, ‘camnh’) INTO Customer
4. In many-to-many relationship between entities, where do you put foreign key when
transforming from conceptual model to relational model?
A. Foreign key is in "many" side
B. Foreign key is in "optional" side
C. Foreign key is in "middle" table
D. We don’t have foreign keys between entities
5. What is the following statement is correct regard to UNION query?
A. UNION query combines output from no more than 2 queries with different number ofcolumns
B. UNION query combines output from no more than 2 queries with the same number ofcolumns
C. UNION query combines output from multiple queries and must include the samenumber of
columns
lOMoARcPSD|34971675
D. UNION query combines output from multiple queries and can include different number of
columns.
6. Which SQL is correct for select records from student table with id = 6 and id = 7.
Assuming student table has only 7 records with Id auto-increment from 1->7?
A. SELECT * FROM Student WHERE id = 6 OR id = 7
B. SELECT * FROM Student WHERE id IN (6,7)
C. SELECT * FROM Student WHERE id NOT IN (1,2,3)
7. It's the best practice when we hit index for columns which contain lots of NULL value to
optimize searching? TRUE
8. A strong entity is an entity which lives independently? TRUE
9. Which of the following is the basic approaches for combine result from tables?
A. INNER JOIN
B. OUTER JOIN
C. Subquery
D. All of the above
10. Which is not a DDL Command in SQL below?
A. ALTER
B. UPDATE
C. CREATE TABLE
D. SELECT
11. A relationship is which of the following?
A. Link between entities
B. Property or characteristic of an entity
C. A person, place, or thing
D. Weak entity
12. Which is the following SQL execution order for the following query?
SELECT COUNT(*)
FROM customers
WHERE customer age > 20
lOMoARcPSD|34971675
GROUP BY customer age HAVING COUNT (*) > 2
ORDER BY customer age
A. FROM -> WHERE -> GROUP BY -> HAVING -> SELECT -> ORDER BY
B. SELECT -> FROM -> WHERE-> GROUP BY -> HAVING -> ORDER BY
C. SELECT -> FROM -> GROUP BY -> HAVING -> WHERE -> SELECT
D. FROM -> GROUP BY -> HAVING -> WHERE -> SELECT -> ORDER BY
13. In basic ER model learnt, how many relationship degree between Entities?
A. 1
B. 2
C. 3
D. 4
14. Data ____ language is a group of commands name to run some basic queries such as
GRANT or REVOKE.
Answer: CONTROL
15. Generalization is a technique of defining a generic entity from
sub-entities (BOTTOM-UP) approach; while specialization is a technique
of defining subtypes from supertype (TOP-DOWN)? FALSE
16. How to make data stored permanently when use database transaction?
A. COMMIT
B. ROLLBACK
C. BEGIN TRANSACTION
D. FLASHBACK
17. What is the name of normalization step to remove partial Dependencies?
A. 1NF
B. 2NF
C. 3NF
D. BCNF
18. In ER model, how many Cardinality of relationships provided?
A. 1
lOMoARcPSD|34971675
B. 2
C. 3
D. 4
19. In conceptual model, Completeness constraints describe instance of
supertype may concurrently be a member of two (or more) subtypes? FALSE
20. In ternary relationship, how many entities joined?
A. More than 3
B. 3 or less
C. 3 or more
D. Exactly 3
21. What is the correct definition for Database management system (DBMS)?
A. hardware system used to create, maintain, and provide controlled access to a database.
B. hardware system used to create, maintain, and provide uncontrolled access to a database.
C. software system used to create, maintain, and provide controlled access to a database.
D. software system used to create, maintain, and provide uncontrolled access to a database.
22. Foreign key is which of the following?
A. An attribute that serves no purpose
B. Any attribute
C. An attribute that serves as the primary key of another relation
D. The same thing as a primary key
23. In a SQL statement, SWITCH ... CASE WHEN... is the representation of?
A. Condition in SQL
B. Loop in SQL
C. Create table in SQL
D. All of the above
24. The command to eliminate a table "Customer" from a database is?
A. DELETE FROM CUSTOMER
B. DELETE TABLE CUSTOMER
lOMoARcPSD|34971675
C. DELETE * FROM CUSTOMER
D. DROP TABLE CUSTOMER
25. How many ways to remove duplicate values in a columns?
A. 1
B. 2
C. 3
D. 4
26. What is the outcome of this query?
SELECT student.name, enrolled.grade FROM student, enrolled WHERE student.id =
enrolled.sid AND enrolled.cid = ’15-415’ AND enrolled.grade IN (‘A’, ‘B’)
A. Returns the name, grade of the students who took course ’15-415′ and got a grade’ A’ or ‘B’
in that course
B. Returns the name, grade of the students who took the course ’15-415′ but didn’t get grade ‘A’
or ‘B’ in that course
C. Statement produces error
D. None of these
27. When an entity instance may be a member of multiple subtypes or it In ternary
relationship, how many entities does not have to be a member of a subtype, it is which of
the following?
A. Overlap with total specialization
B. Disjoint with total specialization
C. Overlap with partial specialization
D. Disjoint with partial specialization
28. In database, the __ deletion mode allows someone try to delete parent row, child rows
with FK -> PK also are deleted as well?
Answer: CASCADE
29. The ability to insert, update, delete in database system are basic operations for?
A. TCL (transaction control language)
B. DDL (Data definition language)
C. DBS (database system)
lOMoARcPSD|34971675
D. DML (Data manipulation language)
30. What is the following statement is correct regard to UNION query?
A. UNION query combines output from no more than 2 queries with different number of
columns
B. UNION query combines output from no more than 2 queries with the same number of
columns
C. UNION query combines output from multiple queries and must include the same number of
columns
D. UNION query combines output from multiple queries and can include different number of
columns.
31. How to make database transaction result stored permanently in the database?
A. COMMIT
B. ROLLBACK
C. VIEW
D. FLASHBACK
32. In basic ER model learnt, how many relationship degree between entities?
A. 1
B. 2
C. 3
D. 4
33. In DB, the ___ deletion mode allows when someone try to delete parent row, if there are
child rows which FK -> PK of parent, they cannot perform deletion?
A. CASCADE
B. SET NULL
C. RESTRICT
D. BLOCK
34. In unary relationship, how many entities joined?
A. More than 1
B. 1 or less
C. 1 or more
lOMoARcPSD|34971675
D. Exactly 1
35. What is called DBMS in the following terminologies?
A. Navicat (a name of a software)
B. Students (a table in navicat)
C. StudentManagement (a database in Navicat)
D. Id (a column in Student table)
36. A ___ is an attribute to determine which is/are subtypes of an instance of a supertype?
Answer: DISCRIMINATION
37. Which is not a DDL Command in SQL below?
A. ALTER
B. UPDATE
C. CREATE TABLE
D. SELECT
38. It's the best practice when we hit index for columns which contain lots of NULL value
to optimize searching? TRUE
39. The ___ attributes is an attribute which contains other child attributes in an Entity?
Answer: COMPOSITE
40. Which is the command to create View?
A. Create table ... as
B. Create [view_name] as ...
C. Create view [view_name] as ...
D. INSERT INTO View [View_name] as
41. Which of the following is the correct INSERT statement, given Customer table has 2
fields: customer_id, name?
A. INSERT INTO Customer VALUES (customer_id = 1, name = 'camnh')
B. INSERT INTO Customer(customer_id, name) VALUE (1, 'camnh')
C. INSERT INTO Customer VALUES (1, 'camnh')
D. INSERT (1, 'camnh') INTO Customer
42. Which forms have a relation doesn't present data duplication?
lOMoARcPSD|34971675
A. 1NF
B. 2NF
C. 3NF
D. 4NF
43. In ER model, how many Cardinalty of relationships provided?
A. 1
B. 2
C. 3
D. 4
44. When an entity instance is a member of only one subtypes and it does not have to be a
member of a subtype, it is which of the following?
A. Overlap with total specialization (x)
B. Disjoint with total specialization
C. Overlap with partial specialization
D. Disjoint with partial specialization
45. Foreign key is which of the following?
A. An attribute that serves no purpose
B. Any attribute
C. An attribute that serves as the primary key of another relation
D. The same thing as a primary key
46. What is the outcome for this query?
Query: SELECT DISTINCT cid FROM ENROLLED WHERE grade = ‘C’
A. Get course id from Enrolled table with grade is 'C'
B. Get course id without duplicates from Enrolled table with grade is 'C'
C. Error
D. None of the above
47. A weak entity is an entity which lives independently? FALSE
48. Normally, you should aim for __ normalization?
A. 1NF
lOMoARcPSD|34971675
B. 2NF
C. 3NF
D. BCNF
49. The command to alter a field info in table "Customer" from a database is?
A. DELETE FROM CUSTOMER
B. DELETE TABLE CUSTOMER
C. ALTER TABLE CUSTOMER
D. DROP TABLE CUSTOMER
50. In one-to-many relationship between entities, where do you put foreign key when
transforming from conceptual model to relational model?
A. Foreign key is in "many" side
B. Foreign key is in "one" side
C. Foreign key is in "middle" table
D. We don't have foreign keys between entities
51. The ability to insert, update, delete in database system are basic operations for
A. TCL (transaction control language)
B. DDL (Data definition language)
C. DBS (database system)
D. DML (Data manipulation language)
52. How to make database transaction result stored permanently in the database?
A. COMMIT
B. ROLLBACK
C. VIEW
D. FLASHBACK
53. In basic ER model learnt, how many relationship degree between entities?
A. 1
B. 2
C. 3
D. 4
lOMoARcPSD|34971675
54. In DB, the ___ deletion mode allows when someone try to delete parent row, if there are
child rows which FK -> PK of parent, they cannot perform deletion?
A. CASCADE
B. SET NULL
C. RESTRICT
D. BLOCK
55. It's the best practice when we hit index for columns which contain lots of NULL value
to optimize searching? TRUE
56. When an entity instance is a member of only one subtypes and it does not have to be a
member of a subtype, it is which of the following?
A. Overlap with total specialization
B. Disjoint with total specialization
C. Overlap with partial specialization
D. Disjoint with partial specialization