Flashcards
Relational Data Model
Cards in this deck (11)
- 1What is physical data independence?Physical schema can be changed without changing applications. For example, changing different file structures, storage methods, etc. should not affect the conceptual schema.
- 2Cardinality is given by the number of ____, while degree/arity is given by the number of ____.rows, fields
- 3What are integrity constraints?Conditions that hold for ANY instance of the database
- 4A set of fields is a key for a relation if it satisfies what conditions?1. it is unique; no two distinct tuples can have all the same values in all key fields
2. none of its subsets are keys - 5A ____ key is defined by the DB, and a ____ is made up of all keys of the relation.primary, candidate
- 6What makes a superkey different from a regular key?The condition that a key cannot have a subset which is also a key doesn't necessarily hold for a superkey. If BC is a key, ABC can be a superkey.
- 7True or false: a table can have many primary keys.False; a table can only have one primary key. It can have many candidate keys, though.
- 8What is a foreign key?A set of fields in one relation that "refers" to a tuple in another relation. A FK must correspond to a key of the other relation.
- 9True or false: a foreign key can ONLY refer to primary keys of the other relation, and not to candidate keys.False
- 10How is a view different from a regular table?A view is still a relation, but we store a definition rather than a set of tuples:
CREATE VIEW ViewName
AS (SELECT ...) - 11Why is a view useful/worth creating?Views can be used to present necessary information while hiding information that is either irrelevant or needs to be protected.