Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
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).
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:
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.
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
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.)