Presentation is loading. Please wait.

Presentation is loading. Please wait.

Conceptual modeling of databases

Similar presentations


Presentation on theme: "Conceptual modeling of databases"— Presentation transcript:

1 Conceptual modeling of databases
Database Management Systems Instructor: Karthik Srinivasan 5/19/2019 Database Management Systems

2 Recollect What is a database?
A database is an organized collection of logically related data, designed to meet the information needs of an organization 5/19/2019 Database Management Systems

3 Learning objectives To be able to describe a database miniworld
To be able to describe what is conceptual model in database design To be able to define the elements of a conceptual model To be able to create a conceptual model (i.e., an entity relationship diagram) for a given description of a miniworld 5/19/2019 Database Management Systems

4 Miniworld A miniworld is a system we are interested in knowing more about, and whose data we wish to store and access using a database Examples of miniworlds: A company A restaurant A shop A hospital Miniworld are also called as universe of discourse. 5/19/2019 Database Management Systems

5 A miniworld contains entities
Customers Products Employees Transactions Operating costs Miniworld of a shop Suppliers Stock Can you list entities of the miniworld of a university? 5/19/2019 Database Management Systems

6 What is a conceptual model?
Schema of a database modeled as a collection of entities and relationships among entities Also called Entity-Relationship Diagram or an ER model Representation of business rules and requirements as a diagram What is the need to represent business rules using a conceptual model? 5/19/2019 Database Management Systems

7 Need for a conceptual model
Starting point for the design process after requirement gathering/analysis A communication tool to describe the database A model is independent of technology Elicits business rules to all stakeholders Strong foundation for development process 5/19/2019 Database Management Systems

8 How a conceptual model looks like…
5/19/2019 Database Management Systems

9 Chen notation for conceptual modeling
5/19/2019 Database Management Systems

10 Entity class, instance and attribute
Entity class: An abstract representation of a person, place, thing, or event about which information is maintained e.g., Customer, Product, Company Instance: A specific person, place, thing, or event; a single representation of an entity e.g., John (Customer), iPhone X (Product), Intel (Company) Attribute: A characteristic or quality of an entity e.g., Age (Customer), Cost (Product), Turnover (Company) A record is also called instance/tuple/entry 5/19/2019 Database Management Systems

11 Entity class, instance and attribute
Entity class often corresponds to a table in a database e.g., Customers table, Products table, Companies table Instances correspond to rows in the table represented by an entity class Attributes correspond to columns in the table represented by an entity class A record is also called instance/tuple/entry 5/19/2019 Database Management Systems

12 Entity class and instances
Students Entity/Instance “Hi - I’m Mark.” “Hi - I’m John.” “Hi - I’m Julia.” Entity class 5/19/2019 Database Management Systems

13 Entity class as a table Students
Given that we have some information about each of these students, we can create the following table STUDENTS table Students Mark John Julia Student Name Student Student GPA Mark 3.8 John Julia 3.9 5/19/2019 Database Management Systems

14 Representing the Entity class
STUDENTS table STUDENTS Entity class Student Name Student Student GPA Mark 3.8 John Julia 3.9 STUDENTS student GPA student Name Student Note that the conceptual model does not show entity instances! 5/19/2019 Database Management Systems

15 A more verbose example John Doe bought 10 dollars worth of Cheese and 20 dollars worth of Ham in the foods section of Walmart How many entities are present in the above Walmart mini-world? A record is also called instance/tuple/entry Note that the mini-world (i.e., Walmart) itself is NOT specified as an entity 5/19/2019 Database Management Systems

16 Entities – Example (contd.)
Answer: 4 entities from 3 entity classes John Doe bought 10 dollars worth of Cheese and 20 dollars worth of Ham in the foods section of Walmart A record is also called instance/tuple/entry 5/19/2019 Database Management Systems

17 Entities – Example (contd.)
John Doe bought 10 dollars worth of Cheese and 20 dollars worth of Ham in the foods section of Walmart PRODUCTS table CUSTOMERS table Product Product ID Product type Cheese 23322 Milk-based Ham 23244 Meat Name Customer ID Address John Doe 832333 1333 N . SECTIONS table Section Section ID Section category Foods 2 Perishable 5/19/2019 Database Management Systems

18 Primary Key Primary key is an attribute in an entity class that uniquely identifies an entity/instance It is one of the attributes chosen to identify entity instances uniquely The attribute which is the primary key: Should not change values over time for each row Must be unique for each row Must have non-null values for each row 5/19/2019 Database Management Systems

19 Primary key - Example STUDENTS
studentID studentName student STUDENTS table Student ID Student Name Student 212 Mark 213 John 214 Julia Why should StudentID be the primary key and not Name or ? 5/19/2019 Database Management Systems

20 Primary key – Another example
TEACHERS teacherID teacherName teacher teacherSalary Which is the primary key for TEACHERS entity class? Can you create the table for the TEACHERS entity class? 5/19/2019 Database Management Systems

21 TEACHERS entity class TEACHERS Teacher ID Teacher Name Teacher Email
teacherSalary Teacher ID Teacher Name Teacher Teacher salary 512 Martha NULL 513 Bob 44,500 TEACHERS table 5/19/2019 Database Management Systems

22 COURSES entity class We want to represent all COURSES and keep track of course numbers and course names. courseNo courseName Course ID Course Name 122 Geography 123 History COURSES 5/19/2019 Database Management Systems

23 What we have done so far We have created the STUDENTS, TEACHERS, and COURSES entity classes Each entity has its own attributes Each entity has a primary key 5/19/2019 Database Management Systems

24 Entities are connected by Relationships
TEACHERS teach COURSES teacher teacherName courseNo courseName Teach COURSES TEACHERS teacherSalary teacherID 5/19/2019 Database Management Systems

25 Entities are connected by Relationships
STUDENTS enroll in COURSES courseName studentID courseNo Enroll_In STUDENTS COURSES studentName student 5/19/2019 Database Management Systems

26 Conceptual model for our example
courseNo courseName teacher teacherName Teach COURSES TEACHERS teacherSalary teacherID studentID Enroll_In STUDENTS studentName student Miniworld description: Teachers teach courses in which students enroll into 5/19/2019 Database Management Systems

27 Conceptual modeling guidelines
Get description of the mini-world through requirement analysis Determine entity classes from the description Mark attributes for the entity classes Mark identifiers for each entity class Determine relationship classes among the entity classes Capture the user data requirements using entities, the properties of entities (i.e., attributes) and relationships between entities Use different names for different elements If an entity has only one attribute, ask yourself if it is really necessary 5/19/2019 Database Management Systems

28 What we learned in this module
Describe a database miniworld Describe what is conceptual model in database design Define the elements of a conceptual model – Entity class, entity instances, entity attributes, relationship, primary key Create a conceptual model (i.e., an entity relationship diagram) for a given description of a miniworld 5/19/2019 Database Management Systems

29 A take-home example Mariott international is a hospitality company that owns several hotels across the globe. Each hotel has a unique hotel ID, website, address and customer service phone number and . Customers checking into hotels in Mariott are assigned a unique customer number. Information such as phone number, credit card type, number of days of stay, check-in date, type of suite booked are logged for each customer. Refer the reference textbook for more worked out examples. More practice is always recommended 5/19/2019 Database Management Systems

30 Topics for upcoming classes
Types of attributes Cardinality of relationships Types of relationships Weak entity classes Enhanced ER modeling 5/19/2019 Database Management Systems


Download ppt "Conceptual modeling of databases"

Similar presentations


Ads by Google