click below
click below
Normal Size Small Size show me how
COP4710 - Midterm 14
2014 Summer COP4710 Midterm
| Question | Answer |
|---|---|
| What is a database? | A collection of data items related to some enterprise. |
| In the Relational Model, data is stored in | Tables |
| The word "Relational" refers to __________, while a "Relation" is a __________. | set-based mathematics; a table |
| Physical data independence means | Data is isolated from the underlying hardware by high level abstractions. |
| If a table contains two attributes that are each unique on their own, and either one could serve as a primary key, these attributes are called | Candidate keys |
| Every table must have a | Primary Key |
| Rows in a relational table need not be unique; there can be duplicate rows in a table | False |
| "Tuple" is the mathematical name that is analogous to a | Row |
| The mathematically-based framework of Codd's Relational Model is called a "__________ Data Model". The data-structure-based framework of Bachman's Network Database is called a "__________ Data Model". | Conceptual, Physical |
| Which of the following is not part of Peter Chen's Entity Relationship model? | Primary Keys |
| In a one-to-many (1:M) relationship, the entity on the "many" side is the | child |
| An ID-Dependent Entity is | An entity whose identifier (key) contains the identifier of another entity. |
| "One-to-one", "one-to-many", and "many-to-many" (or 1:1, 1:M, and M:M) are examples of | cardinality ratios |
| A table in a database is equivalent to a(n) _____ in an ER Diagram, and a row or tuple is equivalent to a(n) _____. | Entity Class, Entity Instance |
| All ID-dependent entities are weak, but not all weak entities are ID-dependent | True |
| An advantage in expressing a data model as an ER diagram is that ER diagrams are very uniform in their notation and all database designers use identical standards in producing ER diagrams. | False |
| Mandatory Participation means | The minimum cardinality of a relationship is one or more |
| A relationship name in an ER diagram can be different depending on the direction you read the relationship. | True |
| We have to determine foreign keys when building an ER diagram. | False |
| A Composite Identifier or Composite Key is | An Identifier or Key that is made up of more than one attribute. |
| A mandatory participation constraint (meaning there is a required participation between one entity and another) always indicates that an entity is weak. | False |
| In SQL, how do you select a column named "FirstName" from a table named "Employee"? | SELECT FirstName FROM Employee |
| In SQL, how do you select all the columns from a table named "Employee"? | SELECT * FROM Employee |
| In SQL, how do you select all the rows from a table named "Employee" where the value of the column "FirstName" is "John"? | SELECT * FROM Employee WHERE FirstName = 'John' |
| What SQL statement is used to return only different values from a table, eliminating duplicates? | SELECT DISTINCT |
| With SQL, how can you return all the rows from a table named "Employee" sorted in descending order by FirstName? | SELECT * FROM Employee ORDER BY FirstName DESC |
| In SQL, how do you list all the rows of the Employee table and Dependent table that match on the EmployeeId attribute? | SELECT * FROM Employee JOIN Dependent ON Employee.EmployeeId = Dependent.EmployeeId |
| What query would we use to select all the employees from the Employee table whose first name is the same as his last name? | SELECT * FROM Employee WHERE FirstName = LastName |
| What is the difference between an INNER JOIN and a LEFT JOIN? Remember that "JOIN" is the same as "INNER JOIN". | The INNER JOIN returns only the rows in which the join attributes match, and the LEFT JOIN returns all of the rows of the left table, along with the rows of the right table in which the join attributes match. |
| In SQL, how do you add a new row to the table named 'Employee'? | INSERT INTO Employee (empNo, fName, lName) VALUES (245, 'Bill', 'Jones'); |
| In SQL, how do you change the value of an attribute in an existing row? | UPDATE Employee SET DeptNum = 200 WHERE EmpNum = 493; |
| In SQL, how do you delete a row from a table? | DELETE FROM Employee WHERE EmpNum = 449; |
| In DDL (Data Definition Language) you can do these three major types of tasks (among other things): | CREATE ALTER DROP |
| The primary purpose of the Subtype/Supertype relationship is to | Eliminate type-inappropriate nulls |
| To implement a Many-to-Many relationship in a relational database, you do this: | Add an intersection table between the two tables. The intersection table will contain a foreign key to each of the two tables being linked. |
| The relational model does not directly support many-to-many relationships. | True |
| The hallmark of an ID-dependent entity is that it | has the identifier (key) of another entity as part of its own identifier. |
| The Association data pattern is similar to a ______ relationship, but with the addition of extra attributes in the ______ table which transforms it to an association table. | many-to-many, intersection |
| Is a foreign key always the key of another table? (Answer True=Yes; False=No) | False |
| If we want to record multiple e-mail addresses for each person in our Contact table, which data pattern would we use? | Multivalued attribute pattern |
| Referential Integrity means: | assuring that the connections between tables remain valid |
| Aggregate functions work with | groups of rows |
| The WHERE clause filters _____ , while the HAVING clause filters _____ . | individual rows, groups |
| WHERE and HAVING are similar because both are | filters |
| A correlated subquery is executed each time | the outer query reads a row from a table |
| If a SQL statement contains a GROUP BY clause, then the SELECT clause can contain only: | the GROUP BY attribute plus aggregate functions |
| n a SQL query containing a GROUP BY clause, filtering of individual rows occurs before filtering and sorting of groups. | True |
| A subquery can appear in a SQL statement wherever a _____ can appear. | table |
| A correlated subquery can often be replaced by a | join |
| Referential Integrity means | a foreign key value in a child table always has a matching primary key value in a parent table. |
| a "Cascading Delete" is | Deleting a row in a parent table automatically deletes any corresponding rows linked by a foreign key in the child table, thereby preventing orphans. |
| When a table has more than one attribute that could each serve as the table's primary key (for example EmployeeNum and SSN), we call these __________ Keys. | Candidate |
| Since we want to consistently use only one key for linking tables together, we select one of the table's candidate keys as the __________ Key. | Primary |
| The primary key of the first table is placed within a second table to establish a means of linking rows in the two tables that belong together, is the __________ Key. | Foreign |
| A Foreign Key column is not a key itself. Each row in the child table contains the same value in its Foreign Key attribute as in the Primary Key attribute of its Parent row. As a result, rows in the two tables are linked together. This works because: | The rows in the two tables have a common value. |
| Give a short explanation of the mechanism whereby a row of one table can be linked to rows of another table. | The Primary Key of the parent table can be placed into the child table as a Foreign Key. |
| What is meant by the term "Weak Entity"? Give an example of a weak entity and tell why it's weak. Why would the database designer need to know it's weak? | A "Weak Entity" is an entity that can't stand on its own but need the presence of another entity. For example, "Report Card" is a weak entity to Student. |
| Your job is to produce a parts table for a lawn mower. The lawn mower has several assemblies: the engine, the deck, and the handle. The engine is composed of the block and the carburetor.... | One‐to‐Many Recursive pattern |
| The Recursive Pattern can model a | All of the above The 1:1 Recursive pattern can model a list in the same way that a linked list can. The 1:M Recursive pattern can model a tree. The M:M Recursive pattern can model a network. |
| Why is using surrogate keys usually considered a good practice? | A surrogate key doesn't represent a fact about an entity. It's a pure linking construct. If a natural key were used in a table, the fact it represents may change. This would violate the unchangability of primary keys and weaken referential integrity. |
| If we search for NULL values using this statement: SELECT * FROM SomeTable WHERE SomeAttribute = NULL; why won't it return any rows? | This statement never returns rows because the WHERE clause never evaluates to True. It always evaluates to Unknown because the NULL on the right side of the equal sign is Unknown. |