Test 2 Flashcards
Relational Database
relationships in the database
Database relationships
-connects two table in a data base with a common field
-can be shown as a schema diagram
Why relationships?
-include data from multiple sources
-keep data organized
-reduce data redundancy
-ensure the consistency/accuracy of data
Data redundancy
two fields repeat the same info
Ex: a number correlating to a specific name
Foreign Key
a field that connects to the primary key of another table
Order Table: Menu ID
Menu Table: Menu ID
Foreign Key Constraints
help prevent errors in the data
Referential Integrity
-Every value of a foreign key field has to be a value of the primary key field
-Must have corresponding values between tables
-Ensures consistency/accuracy
What are the two types of referential integrity relationships?
-one to many
-one to one
One-to-many
Each primary key value can show up many times as foreign key
One-to-one
primary key connected to primary key
Subdata sheet
-shows the data in the related table
-all records in the related table connected to the record
-if you change data in this view it changes in the related tables
Summary queries
-calculates statistics about groups of records
-returns the unique number of records
Group by field
-query groups the query results by this field
-usually applied to categorical fields
What happens if group by is applied to multiple fields?
-query will group the results by all of the fields
-If all groupings of field A are within field B you will see same results
How to approach a problem
-Examine the data
-examine the tables
-import each table one at a time
-make adjustments according to question
-define relationships
-create a query for each question