2. MODULE OVERVIEW
• Designing of complex databases.The concept of the
normalization of the database. Linking fields
• Query from several tables. Data scheme. Subordinated
tables
• Working with subordinate tables. Solving data integrity
problems
• Support for data integrity. Merge Options. Substitutions.
Practical examples of substitutions
• Types of relationships between tables
3. LESSON 1: DATABASE DESIGN
• Designing of complex databases.The concept of
the normalization of the database. Linking fields
• Query from several tables. Data scheme.
Subordinated tables
4. DATABASE DESIGN
The process of solving a class of problems associated with
the creation of databases:
• Storing the necessary information in the database
• The ability to receive data through the necessary requests
• Reduce redundancy and data duplication.
• Ensure data integrity
• Elimination of contradictions
• Data loss exclusion
7. CONCEPTUAL DESIGN
• Construction of a formalized domain model
• built using graphic language tools
• ER charts
• without focusing on a specific DBMS
• The main elements of the model:
• Description of domain objects and links between them
• Description of user information needs
• basic database queries
• Description of algorithmic data dependencies
• Description of integrity constraints
• valid data value requirements to the connections between them
9. LOGICAL DESIGN
• Mapping of the infological model to the data model used in a
specific DBMS
• for example the relational data model
• For relational DBMS - a set of tables
• with key fields
• relationships between tables
• If the infological model is constructed in the form of ER-
diagrams, constructing tables according to certain
formalized rules and normalizing them
• This stage can be automated
10. PHYSICAL DESIGN
• Implementation of the datalogical model using specific
DBMS
• Choosing solutions related to the physical storage
environment
• disk space management
• data access methods
• data compression methods
• Tasks are solved by DBMS and
are hidden from the database developer
11. NORMALIZATION
• The process of converting a database to a form that
meets normal forms
• Designed to bring the database structure to a form that
provides minimal redundancy
• Not intended
• decrease or increase in productivity
• decrease or increase in database size
• The ultimate goal is to reduce the potential
inconsistency of information stored in the database.
12. NORMAL FORM
• Relation property in relational data model
• characterizes it in terms of redundancy
• could potentially lead to logically erroneous sampling
or change results
• Normal form is defined as the set of requirements that
must be met by
13. TYPES OF NORMAL FORMS
• First Normal Form (1NF)
• In a relational model, a relationship is always in first normal
form by definition
• Second normal form (2NF)
• Third normal form (3NF)
• Boyce-Codd Normal Form (BCNF)
• Fourth normal form (4NF)
• Fifth Normal Form (5NF)
• Domain Key Normal Form (DKNF)
• Sixth normal form (6NF)
14. IN OTHERWORDS
Elimination of redundancy due
to the decomposition of
relations
• only primary data should be kept in
every table
• data that are not inferred from other
stored data
15. RELATIONSHIPS BETWEENTABLES
• Recall the primary and
foreign keys!
• Database Tools >
Relationships
• Types of links:
• One to one
• One-to-many
• Many-to-many*
16. MANY-TO-MANY
You need a junction table with a pair of foreign keys (and some
related fields)
18. QUERIES FROM MULTIPLE TABLES
Alternative:
SELECT DISTINCT Customers.City,
Customers.CompanyName FROM Customers, Orders
WHERE (((Orders.OrderDate) Between #1/1/19981
And #12/31/1998#) And (Customers.CustomerID = Orders.CustomerID))
ORDER BY Customers.City, Customers.CompanyName;
19. LESSON 2: SUBORDINATE TABLES
• Working with subordinate tables. Solving data integrity
problems
• Support for data integrity. Merge Options. Substitutions.
Practical examples of substitutions
• Types of relationships between tables
20. DATA INTEGRITY
• The fundamental principle of the theory of DB
• Database restriction to ensure that the links between the
data are valid and intact
• Benefits:
• Improved data quality
• Development acceleration
• Error reduction
• Consistency between applications
22. DATA INTEGRITY
• check box Enforce Referential Integrity
• Cascade Update Related Fields
• when the key field of the main table changes, the
corresponding values of the field of the related records
will be automatically changed
• Cascade Delete Related Records
• when deleting a record in the main table, all related
records in the subordinate table are also deleted
27. RELATIONSHIPS BETWEENTABLES
• Lt’s recall:
• One-to-one
• One-to-many
• Many-to-many*
• Ways to Join:
• Inner Join
• only those records from tables whose related fields match
• Left outer join (Left Join)
• all records of the first table and only those records of another
table, the values of the associated field of which coincide with the
values of the corresponding field of the first table
• Right Join
• Same as left outer join, but tables change roles
28. TEST QUESTION
It’s a good idea to think of relationships as having “sides.”
(Pick one answer)
1. True
2. False
29. TEST QUESTION
Knowing which side a table is on tells you whether or not it
uses a foreign key field
It’s a good idea to think of relationships as having “sides.”
Answer:
1. True
30. TEST QUESTION
To create one-to-many relationships, you do which of the following?
(Pick one answer)
1. Use the primary key from the table on the “one” side as
a foreign key in the table on the “many” side
2. Use a junction table with at least two foreign key fields
3. Turn off indexing for the primary key field
31. TEST QUESTION
In the asset-tracking database, you can now answer
questions such as, “Which company supplies most of our
computers?”
To create one-to-many relationships, you do which of the
following?
Answer:
1. Use the primary key from the table on the “one” side
as a foreign key in the table on the “many” side
32. TEST QUESTION
To create a one-to-one relationship, you do which of the following?
(Pick one answer)
1. Turn off indexing for the foreign key field
2. Turn on indexing in the foreign key field, but allow
duplicate values
3. Turn on indexing for the foreign key field without
allowing duplicate values
4. Enable referential integrity
33. TEST QUESTION
If you allow duplicate values, you create a one-to-many
relationship
To create a one-to-one relationship, you do which of the following?
Answer:
3. Turn on indexing for the foreign key field without
allowing duplicate values
34. TEST QUESTION
Referential integrity is useful because it does which of the following?
(Pick one answer)
1. Takes the place of an index
2. Keeps primary and foreign key values in synch
3. Allows you to “orphan” data safely
35. TEST QUESTION
Referential integrity can also make it easy to update and
delete data
Referential integrity is useful because it does which of the following?
Answer:
2. Keeps primary and foreign key values in synch
36. TEST QUESTION
To create a many-to-many relationship between Table A and Table B,
you do which of the following? (Pick one answer)
1. Create one-to-one relationships between A, B, and at
least two other tables
2. Add the primary keys from A and B to a “link” or
“junction” table
3. Add as many fields as needed from table A to table B,
and vice versa, until each table contains all the data you
need to track
37. TEST QUESTION
Those foreign keys allow you to see how the data on each
side relate to each other
To create a many-to-many relationship between Table A and Table B,
you do which of the following?
Answer:
2. Add the primary keys from A and B to a “link” or
“junction” table
38. TEST QUESTION
This course has taught you everything you need to know about
relationships. (Pick one answer)
1. True
2. False
39. TEST QUESTION 6
This course has taught you everything you need to know about
relationships
Answer:
2. False
41. BOTTOM LINE
• Designing of complex databases.The concept of the
normalization of the database. Linking fields
• Query from several tables. Data scheme. Subordinated
tables
• Working with subordinate tables. Solving data integrity
problems
• Support for data integrity. Merge Options. Substitutions.
Practical examples of substitutions
• Types of relationships between tables
43. SELF-TEST
• List the known stages of database design.
• What is table normalization?
• How many normal forms do you know?
• Why is data integrity so important?
• What kinds of links can exist between Access
tables?
• How to link database tables?