Download ER to Relational - Summary IT360: Applied Database Systems ER To Relational

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Database wikipedia , lookup

PL/SQL wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Functional Database Model wikipedia , lookup

SQL wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Join (SQL) wikipedia , lookup

Relational algebra wikipedia , lookup

Database model wikipedia , lookup

Relational model wikipedia , lookup

Transcript
IT360: Applied Database Systems
Exercise Set
ER To Relational
ER to Relational - Summary
• Transform entities in tables
– Specify primary and alternate keys
– Specify column types, null status, default values,
constraints
• Transform relationships using foreign keys
– Place the key of the parent in the child
– Create intersection tables, if needed
• Specify logic for enforcing minimum cardinalities
– Actions for insert, delete, update
2
1
SQL: Creating Tables
CREATE TABLE table_name(
column_name1 column_type1 [constraints1],
…,
[[CONSTRAINT constraint_name] table_constraint]
)
Table constraints:
• NULL/NOT NULL
• PRIMARY KEY (columns)
• UNIQUE (columns)
• CHECK (conditions)
• FOREIGN KEY (local_columns) REFERENCES foreign_table
(foreign_columns) [ON DELETE action_d ON UPDATE action_u]
Specify surrogate key in SQL Server:
column_name int_type IDENTITY (seed, increment)
Specify surrogate key in MySQL:
column_name int_type AUTO_INCREMENT
3
Transform to Relational Model
2
Transform to Relational Model
Transform to Relational Model
3
1:1 Recursive Relationship
Transform to Relational Model
1:N Recursive Relationship –
Transform to Relational Model
4
N:M Recursive Relationship
Transform to Relational Model
Transform to Relational Model
Chaired By /Chairs
5