Test 2 Flashcards
(34 cards)
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
Calculated field
-field of data that can be created based on the values of other fields
Expression
-combination of field names, operators, and functions that result in a single value
Function
formula that returns a value
ways to create a calculated field?
-builder function
-type formula in empty field
Pro/con of builder function
-less likely to have format error
-can take a little longer
Pro/con of typing formula into empty field
-can be faster
-more likely for format error
Common functions
-date
-pmt
-left
-right
-len
date function
-calculates number of days between today and the date in the birthdate field
Date()-[birthdate]
pmt function
-calculates monthly payment
pmt([rate],[term],[loan])