FEN 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
Development Process Analyse the problem domain: Identify: entities relations FEN
Development Process FEN Build the conceptual model: Attributes Primary keys Cardinality Participation
Development Process Transform 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
Development Process Result: FEN
Development Process FEN 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
Development Process FEN 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
Development Process Table definitions: Data types (domains) NULLs allowed? Primary key (ids?) Referential constraints (FK-PK references) FEN Constraint
Development Process Execute queries: SELECT, INSERT, UPDATE, DELETE FEN SELECT: Rows and columns Joins Set operations
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
The End! Thank you very much – hope you liked it. FEN