Connecting with Computer Science Chapter 6 Review

advertisement
Connecting with Computer Science Chapter 6 Review:

A database is a collection of logically related information used in an application to create meaningful
output for end users.

Normalization is the process of structuring tables to eliminate un-wanted redundancies and
dependencies.

Database information is kept in a sequential order, but you can view the order of records in different
formats by creating indexes and assigning sort keys.

Primary keys are used to uniquely identify table entries; foreign keys are columns in one table that
reference a primary key in another table.

The manner in which one table relates to another table is called a relationship.

The 3 types of relationships discussed are: one-to-one (1:1), one-to-many (1:M) and many-to-many
(M:M).

First Normal Form [1NF] eliminates repeated fields.

Second Normal Form [2NF] dictates that every column that is not part of the primary key is fully
dependant on the primary key.

Third Normal Form states that no column can depend on any other column than the primary key.

Fourth and Fifth Normal Form are rarely used but further break down tables into non-dependant, nonredundant forms.

The 6 steps for designing a database are: Investigate, Create a master column list, create the tables,
assess the relationships, analyze the design and re-evaluate.

Structured Query Language (SQL) is a powerful database language for: Defining, Maintaining, Querying
and administering data.
Key Terms:
Cardinality:
Column (field or attribute):
Composite key:
Database:
Shows the numeric occurrences between entities in an ER model. (228)
A specific piece of information in a table row. (211)
A primary key made up of more than one column. (220)
Data that has been logically related and organized into a file or set of files to allow access
and use. (207)
DBMS:
A program for managing storage, access and modifications to a database. (209)
Determinant:
In a database, any column you can use to determine the value assigned to another
column in the same row. (220)
Domain:
Set of possible values for a column. (212)
Entity relationship model:
A data model that represents how all tables interact and relate to each other in the
database. (228)
First Normal Form (1NF):
Eliminating repeating fields or groups of fields from the table and confirming that every
column has only 1 value by creating a new record in the table. (218)
Foreign key (FK):
A column in 1 table that relates to a primary key in another table. (226)
Functional dependency:
A column's value is dependent on another column's value. (220)
Index:
A special file that occupies its own space and specifies one or more columns that
determine how information stored in the table can be accessed more efficiently. (213)
Many-to-Many Relationship: Many instances of one entity or table are associated with many instances of another
entity. (228)
Normalization:
A database design process that structures tables to eliminate duplication and
inconsistencies in the data structure. (216)
One-to-Many Relationship:
One instance of an entity is associated with zero to many instances of another table. (227)
One-to-One Relationship:
One instance of an entity is associated with only one instance of another entity. (228)
Primary Key (PK):
A column or combination of columns that uniquely identifies a row in a table. (219)
Relationship:
How one entity or table works with another. (226)
row (record or tuple):
A collection of columns. (211)
Second Normal Form (2NF): First Normal Form has already been applied to the table, and every column that is not
part of the primary key is fully dependant on the primary key. (220)
Sort Key:
In a database table 1 or more columns used to determine the data's sort order
normalization: a database design process that structures tables to eliminate duplication
and inconsistencies in the data structure. (214)
SQL:
A special language used to maintain database structure and modify, query and extract
information. (209)
Table (or entity):
Data arranged in rows and columns, much like a spreadsheet. (211)
Third Normal Form (3NF):
Eliminates columns that are not dependent on only the primary key. (222)
transitive dependency:
One column is dependent on another column that is not a primary key. (222)
Test Your-self:
1.) What is a database? Give an example of a database in current use that affects you
 data that has been logically related and organized into a file or set of files to allow access and use
 MySQL
2.) The table is listed in what order (primary key)?
 Ascending order
3.) Write a SQL SELECT statement to list the table's contents in order of wins
 SELECT * FROM baseball ORDER BY wins;
4.) Write a SQL SELECT statement to list the table's contents in order of wins and team
 SELECT * FROM baseball ORDER BY wins AND team;
5.) Write a SQL INSERT INTO statement to add the team Bears. The bears have 3 wins and 9 losses
 INSERT INTO baseball(team, wins, losses) VALUES (‘Bears’, ‘3’, ‘9’);
6.) Write a SQL INSERT INTO statement to add the team Lions. The Lions have 9 wins and 3 losses
 INSERT INTO baseball (team, wins, losses) VALUES (‘Lions’, ‘9’, ‘3’);
7.) Write a SQL SELECT statement to list all the table's contents
 SELECT * FROM baseball;
8.) What is normalization and what problems does it solve
 a database design process that structures tables to eliminate duplication and inconsistencies in the data
structure.
9.) Explain the first 3 normalization forms
 1ST NF: eliminating repeating fields or groups of fields from the table and confirming that every column has
only 1 value by creating a new record in the table
 2ND NF: first normal form has already been applied to the table, and every column that is not part of the
primary key is fully dependant on the primary key.
 3RD NF: eliminates columns that are not dependent on only the primary key
10.) List and explain the six steps for designing a database
 Step 1: Investigate and define
 Research and investigate the information you want plan to model. Define the purpose of
the database and how you plan to use it. Use end-use documents to define fields. Involve endusers.
 Step 2: Make a master column list
 Create the input fields. Review documents.
 Step 3: Create the tables
 After all the tables and columns have been defined. It is time to group them into tables. Try to follow
the rules of normalization. Look for duplicates tables or data types and try to eliminate them.
 Step 4: Work on relationships

Finalize the relationship you have observed during the design and normalization process.
In database design, a relationship defines how one table works with another. Relationships can
either be: 0:1, 0:M, 1:1, 1:M, M:1, M:M
 Step 5: Analyze the design

Review your design and search for design errors refining tables as needed. Ultimately aim for 3rd
NF. Create a database model, to serve as a visual representation. This model is called an ER model.
 Step 6: Re-Evaluate

Reevaluate database performance and ensure that it meets all your reporting and form needs.
Include end-users and explain each table and field being used. Make sure fields have been defined
to address end users' requirements.
11.) Create a normalized database to support a space shuttle launching application. The government wants to
keep track of: astronauts, space shuttles and launch history. Define the tables, primary and foreign keys and
indexes. Make sure the tables are finalized in the 3rd normalized state.
12.)
Draw an ER model to represent the space shuttle launching application designed in question 11. Make sure
you show the relationships, label the cardinality, and show primary and foreign keys.
Astronaut Data
Space Shuttle
data
Field Name
Error_Log_Date
Error_Log_Time
User_Code
User_First
User_Last
Error_Code
Error_ Code_Desc
User_Password
Error_Log_Desc
Error_Status_Code
Error_Priority_Code
Field Size
8
15
25
4
40
10
80
1 if text
Space Shuttle
data
Field Type
Date
Time
Text
Text
Text
Text
Text
Text
Text
Yes / No or Text
Number
Sample Data
12/15/2010
2:24:32 PM
KATIE
KAYTLEN
ANDERSON
LOG
INCORRECT LOGIN
MONK
USER INPUT WAS BAD
C -- Completed
U -- Unresolved
I -- In process of being fixed
Can contain a number from 1 5:
1 --- Very High
2 --- High
3 --- Medium
4 --- Low
5 --- Very Low
13.)
14.)
Download