Universita’ di Milano Bicocca Carlo Batini Course in Data Base Design Part 1 – Introduction to Data Bases
© Carlo Batini, 2015 This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/
High level conceptual map
Low-level conceptual map
A thermometer
Organizational system and Information System Input: Goods or requests of Services Output: Goods or delivered Services Processes Human Resources Infor- mation ICT Technologies Hardware Software Network Data Information System
Computer structure
Two tables
Two tables
Two software applications using data Courses of Professors Salaries of Professors Course Assignment Salary Management
The new set of tables
The data base approach Courses Course Assignment Professors Salaries Course Assignment Salary Management Professors
Database Management Systems allow concurrent and efficient access to the data base Courses Salaries Course Assignment Salary Management Professors Database Management System
The new set of tables Salaries Professors Courses Level Yearly Salary 1 20.000 2 25.000 3 30.000 4 35.000 Course # Prof Id Prof. Surname Level 37 1 Xu 4 29 16 2 Smith 3 Courses Student Id Prof Id Grade 37 1 80 29 95 16 2 85
The new set of tables
Database Management System and its relationship with a computer Software applications Users DBMS Secondary Memory Computer
Hierarchical and relational models of data Student Id Course Id Grade 12127 37 80 29 90 18 85 23344 95 Student Id Course Id Grade 12127 37 80 29 95 18 85 23344
Hierarchical Relational Student Id Course Id Grade 12127 37 A 29 C 18 B 23344 Student Id Course Id Grade 12127 37 A 29 C 18 B 23344
Databases as representation of a piece of reality using a data model
A relation (or table)
Reality, database, schema and instance Representation Model Database Concepts Schema Values of concepts Instance
Exercise 1.1 - Given the following database, reply to the following questions
Design phase of the Database life cycle Database schema Schema Design Students, with Student Id and Surname Relational model Student (Student Id, Surname)
Instance update phase
Student Data Schema Data Values Student Id Course Id Grade 12127 37 80 29 95 18 85 23344 Data Values
DB Design LC Conceptual design Conceptual schema Logical design Logical schema Relational model Conceptual design Requirements Entity Relationship Model DB Design LC
Assume we are in a Chinese University (where grades are among 0 and 100). You want to represent: three exams passed by a student with Student Id = 12127 referring to: 1. Course with Course Id = 37 and exam passed with grade 80. 2. Course with Course Id = 29 and exam passed with grade 90. 3. Course with Course Id 18 and exam passed with grade 85. one exam passed by a student with Student Id = 23344 referring to: 1. Course with Course Id = 29 and Exam passed with grade 95.
Query phase Database instance Query Query language E.g. Which surname has the Student with StudentId = 29? Table result of query E.g. Xu
Databases as representation of a piece of reality using a data model
Central Processing Secondary Memory Unit Channels Main memory Input 10-8/10-9 seconds 10-2 External World Input Output Devices
Conceptual design and Logical design Conceptual schema Logical design Logical schema Relational model (closer to the DBMS) Conceptual design Requirements Entity Relationship Model (closer to the user) Conceptual design and Logical design
Concepts introduced in Part 1
Resti
Student Schema Data Student Id Course Id Grade 12127 37 80 29 95 18 85 23344 Data
Student Data Schema Data Values Student Id Course Id Grade 12127 37 80 29 95 18 85 23344 Data Values
Design phase of the Database life cycle
Instance Update phase Database schema Create and update Relational instances Manipulation language Relation instance (e.g. Student Id = 37, Surname = Wang Student Id = 29, Surnaqme = Xu Database Instance
three exams passed by a student with Student Id = 12127 referring to: Assume we are in a Chinese University (where grades are among 0 and 100). You want to represent: three exams passed by a student with Student Id = 12127 referring to: 1. Course with Course Id = 37 and exam passed with grade 80. 2. Course with Course Id = 29 and exam passed with grade 90. 3. Course with Course Id 18 and exam passed with grade 85. one exam passed by a student with Student Id = 23344 referring to: 1. Course with Course Id = 29 and Exam passed with grade 95. Assume we are in a Chinese University (where grades are between 0 and 100). You want to represent: three exams passed by a student with Student Id = 12127 referring to: 1. Course with Course Id = 37 and exam passed with grade 80. 2. Course with Course Id = 29 and exam passed with grade 90. 3. Course with Course Id 18 and exam passed with grade 85. one exam passed by a student with Student Id = 23344 referring to: 1. Course with Course Id = 29 and Exam passed with grade 95.
Modeling Relational Model Student Student Id Course Id Grade 12127 37 Assume we are in a Chinese University (where grades are between 0 and 100). You want to represent: three exams passed by a student with Student Id = 12127 referring to: 1. Course with Course Id = 37 and exam passed with grade 80. 2. Course with Course Id = 29 and exam passed with grade 90. 3. Course with Course Id 18 and exam passed with grade 85. one exam passed by a student with Student Id = 23344 referring to: 1. Course with Course Id = 29 and Exam passed with grade 95. Relational Model Modeling Student Student Id Course Id Grade 12127 37 80 29 95 18 85 23344
Courses Course Assignment Professors Salary Management Salaries
Hierarchical and relational models of data Student Student Student Id Course Id Grade 12127 37 80 29 90 18 85 23344 95 Student Id Course Id Grade 12127 37 80 29 90 18 85 23344 95 Hierarchical Model Relational Model