Chapter 4 Flashcards
What is data structure?
Tables (relations), rows, columns
What is data manipulation?
Powerful SQL operations for retrieving and modifying data.
What is data integrity?
Mechanisms for implementing business rules that maintain integrity of manipulated data
What is a name, two-dimensional table of data?
A relation
What consists of rows (records) and columns (attribute or field)?
A table
What are the requirements for a table to qualify as a relation?
- Must have a unique name
- Every attribute value must be atomic (not multivalued, not composite)
- Every row must be unique (can’t have two rows with exactly the same values for all their fields)
- Attributes (columns) in tables must have unique names.
- The order of the columns must be irrelevent.
- The order of the rows must be irrelevent.
What must all relations be in?
1st Normal form
How do relations correspond with the E-R model?
- Relations (tables) correspond with entity types and with many-to-many relationship types.
- Rows correspond with entity instances and with many-to-many relationship instances
- Columns correspond with attributes.
Are relation (in relational database) and relationship (in E-R model) the same?
No, they are not the same.
What are special fields that serve two main purposes (Primary and Foreign)?
Keys
What two main purposes do keys serve?
- Primary Key
- Foreign Key
What is a primary key?
Unique identifiers of the relation.
Example: Employee numbers, SSN etc.
This guarentees that all row are unique
What are Foreign keys?
Identifiers that enable a dependent relation (on the many side of a relationship) to refer to its parent relation (on the one side of the relationship)
How are the fields in keys defined?
Simple (a single field) or composite (more than one field)
How are keys usually used?
As indexes to speed up the response to user queries.
Keys (Visual example)
What are domain constraints?
Allowable values for an attribute
Example: setting restrictions for what can be input for an attribute.Visual below
What does entity integrity mean?
- That no primary key attribute may be null. All primary key fields MUST contain data values.
What is referential integrity mean?
It refers to rules that maintain consistency between the rows of two related tables.
What are rules that state that any foreign key value (on the relation of the many side) MUST match a primary key value in the relation of the one side. (Or the foreign key can be null)?
Referential Integrity
What is an example of Referential Integrity?
Delete Rules
Restrict - don’t allow delete of “parent” side if related rows exist in “dependent” side
Cascade - automatically delete “dependent” side rows that correspon with the “parent” side row to be deleted
Set-to-Null - set the foreign key in the dependent side to null if deleting from the parent side -> not allowed for weak entities