Database Quizzes
Referring to the figure below, which of the following is NOT true? (ITEM/COMPONENT Diagram)
A component is always used in only one item.
What will be returned when the following SQL query is executed? Select Driver_No, COUNT (*) AS Num_Deliveries FROM DELIVERIES GROUP BY Driver_No HAVING COUNT(*) > 2
A listing of all drivers who made more than 2 deliveries as well as a count of the number of deliveries
Which statement is true about the following diagram? (PERSON, FACULTY, STUDENT, STAFF, GRADUATE, UNDERGRADUATE Diagram)
All attributes of person and student are inherited by undergraduate.
What does the following SQL statement do? Update Product_T Set Unit_Price = 775 Where Product_ID = 7
Changes the unit price of Product 7 to 775
What result set will the following query return? Select Top 3 P_code, V_code, P_Price, P_Description from Product Order by 3;
Display the first three rows returned by the SELECT statement, and order by P_Price.
A cardinality constraint tells what kinds of properties are associated with an entity.
False
A default value is the value that a field will always assume, regardless of what the user enters for an instance of that field.
False
A relational table cannot have more than one primary key and one foreign key.
False
Attribute names should always be specified in an INSERT command.
False
Both primary key and foreign key cannot contain any null value.
False
Given the data in the Product table used in our in class exercises, the following statement will show the P_code, V_code and average price of the products offered by each vendor from the Product table. SELECT P_code, V_code, AVG(P_price) from PRODUCT GROUP BY V_code;
False
In the figure shown below, a rental unit can be both an apartment and a house but must be at least one. (RENTAL UNIT, APARTMENT, HOUSE Diagram)
False
Subtypes inherit the relationships from supertype, hence the relationships a subtype participates in are always the same as the relationships the supertype participates in.
False
The DROP command deletes rows from a table individually or in groups.
False
The HAVING clause and the WHERE clause cannot be used simultaneously because they perform the same operation.
False
When we use the CREATE VIEW command to generate the view, it essentially creates a table and save it as a physical table in the database so that users can view the content at any time.
False
All of the following are valid data types supported in MS SQL Server EXCEPT:
NUMBER
The subtype discriminator in the figure below is: (PART, SUPPLIER, MANUFACTURED PART, PURCHASED PART, SUPPLIES Diagram)
Part_Type
In the figure below, what type of key is depicted? Unary Employee Diagram
Recursive Foreign
In the figure below, what type of relationship do the relations depict? (Employee/Child Diagram)
Strong Entity/Weak Entity
Which of the following is NOT a rule that we should follow when selecting a Foreign Key:
The selected attribute must have the same attribute name in the two connected tables.
A supertype/subtypes hierarchy that exhibits total specialization/completeness implies that the subtype discriminator attribute in the supertype entity should not contain any null value.
True
An entity instance of a subtype represents the same entity instance of the supertype.
True
If an identifier is not assigned, the default primary key for an associative relation consists of the two primary key attributes from the other two relations.
True
If multiple Boolean operators are used in an SQL statement, NOT is evaluated first, then AND, then OR.
True
In a supertype/subtype hierarchy, all supertypes and subtypes share the same primary key.
True
The FROM clause is the first statement processed in an SQL command.
True
The WHERE clause is always processed before the GROUP BY clause when both occur in a SELECT statement.
True
The following two SQL statements will produce the same results. SELECT Last_Name, First_Name FROM CUSTOMER WHERE State = 'MA' OR State = 'NY' OR State = 'NJ'; SELECT Last_Name, First_Name FROM CUSTOMER WHERE State IN ('MA','NY','NJ',);
True
The total completeness constraint implies that each entity of the supertype must be a member of one of the subtypes in the relationship.
True
There are three separate discriminators in the following diagram because of the overlapping constraint. (ROOM, CLASSROOM, LABORATORY, OFFICE Diagram)
True
When the On Update Cascade clause is included in a create table command and executed in MS SQL Server, which of the following will happen?
When a value in the PK column of the associated table is changed, the corresponding value in the FK column will be changed to the same value.
When a regular entity type contains a multivalued attribute, one must:
keep the existing relation and create a new relation to house the multivalued attribute.
A relationship where the minimum and maximum cardinality are both one is a(n) ________ relationship.
mandatory one
A student can attend five classes, each with a different professor. Each professor has 30 students. The relationship of students to professors is a ________ relationship.
many-to-many
The entity integrity rule states that:
no primary key attribute can be null.