Upload
torin
View
33
Download
0
Embed Size (px)
DESCRIPTION
Seminar: Introduction to relational databases. Development process: Analyse the problem domain and build a conceptual model (ER model) Table design Domains Primary key, foreign keys, constraints Quality checking design (normalisation) Create tables Run queries. - PowerPoint PPT Presentation
Citation preview
FEN 2015-09-03 1
Introduction to the database field:
• The development process
Seminar:Introduction to relational databases
Development process:
• Analyse the problem domain and build a conceptual model (ER model)
• Table design
• Domains
• Primary key, foreign keys, constraints
• Quality checking design (normalisation)
• Create tables
• Run queries
2
Development Process
Analyse the problem domain:Identify:• entities • relations
FEN 2015-09-03
3
Development Process
FEN 2015-09-03
Build the conceptual model:• Attributes• Primary keys• Cardinality• Participation
4
Development ProcessTransform the ER model into relational schemas (tables):• 7 steps algorithm:
• Entity -> Table(composite, and multi value attributes)
• Weak entity -> Table(composite key, include owners key)
• 1-1 and 1-n relations(include primary key from one side as foreign key on the other side)
• n-m relations(new table with the primary keys from both sides as foreign keys, composite primary key)
• Multi value attributes - > new table(include the owners primary key as foreign key)
• Relations with degree > 2 -> new table(include all participants primary keys as foreign keys, composite primary key)
FEN 2015-09-03
5
Development Process
Result:
FEN 2015-09-03
6
Development Process
FEN 2015-09-03
Informal Design Guidelines: • Table Semantics• Avoid Redundant Information• Minimise NULL-values• Disallowing the generation of
spurious tuples when joining tables.Normalisation:• 1NF• 2NF• 3NF• BCNF• Look for functional
dependencies / determinants that are not keys
Not in
3NF!
Not in
2NF!
7
Development Process
FEN 2015-09-03
Guideline for Normalisation
All attributes are to depend on the key,the whole key,
and nothing but the key.So help me Codd.
And remember:• FDs are business rules• Normalisation fights redundancy and other maladies in table design
8
Development Process
Table definitions:• Data types (domains)• NULLs allowed?• Primary key (ids?)• Referential constraints (FK-PK references)
FEN 2015-09-03
Constraint
9
Development Process
Execute queries:• SELECT, INSERT, UPDATE, DELETE
FEN 2015-09-03
SELECT: Rows and columns Joins Set operations
10
Do it yourself
If you want to try it your self, you may want to install the free Microsoft SQL Server Express:
SQLServerInstall.pptx
FEN 2015-09-03
11
The End!Thank you very much – hope you liked it.
([email protected], http://public.ucn.dk/fen/angers/)
FEN 2015-09-03