Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 24

ITEC 224 Database

Programming
Conceptual Database Design Example
Learning Objectives
• Conceptual Database Design
• Documentation for Conceptual Database Design
Conceptual Database Design
• Build a local conceptual data model for each specific user view
• User view is the data required by a particular user to make a decision
or perform some task
• Start with data and transaction requirements
Case Study : Online Bookstore
• EMU Bookstore sells books to students and other customers : in store
and online
• Instructors order textbooks for their courses through a web interface.
• Director of each department approves of the textbook orders for
his/her department
• Director of the bookstore may oversee all orders placed in EMU
Case Study : Online Bookstore
• Identify the users
• Online Customers
• Bookstore personnel
• Instructors
• Departmental Directors (Academic)
• Administrator
• Interview each user group to gather the detailed requirements in
terms of transactions and data
Case Study : Online Bookstore
• Instructor –Data Requirements
• Each instructor may order at the most 10 text or reference books each
semester.
• For each text/reference book ordered, the instructor specifies the course
and the number of students who will be taking the course.
• Each course has a unique coursecode, a title. An instructor may teach
many courses.
• Each book has a title, a unique ISBN number and a publisher.
• Also a book may have more than one author.
• An instructor may write reviews about the books he/she has ordered
Case Study : Online Bookstore
• Instructor- Transaction Requirements
• Create a text/reference book order form.
• Enter information about a book that doesn’t exist in the database :book isbn,
title, authors and publisher
• List all courses he/she teaches
• Print a copy of the order form
• Add a review to the book entry
Case Study : Online Bookstore
• Online customers – Data Requirements
• A customer may order one or more books online.
• Each customer must supply his/her name, address and phone number.
• Each book has a title, an ISBN and a price in addition to the subject category,
publisher and one or more authors
Case Study : Online Bookstore
• Online Customer-Transaction requirements
• Search books using title/ISBN
• Search for a book that contains certain keywords.
• Find text/reference books of a given course using the course title and/or
coursecode
• Buy books : create an order that may contain one or more books
• List all the orderd placed so far.
• Administrator
...

• Director

...
Conceptual DB Design
• 1. Build local conceptual Data Model
• 1.1 Identify Entity Types
Instructor : Book, Textbook?, ReferenceBook?, Course, Author, Review?, Order
Online Customer : Book, Course, Order, Customer
Director : Instructors, courses, coursegroups, Textbooks

Document entity types


Hint: Check nouns
1.1 Identity Entity Types!
What is an entity?
Database entity is a thing, person, place, unit, object or any item about which the data should
be captured and stored in the form of properties, workflow and tables

• Instructor –Data Requirements


• Each instructor may order at the most 10 text or reference books each semester.
• For each text/reference book ordered, the instructor specifies the course and the
number of students who will be taking the course.
• Each course has a unique coursecode, a title. An instructor may teach many courses.

• Each book has a title, a unique ISBN number and a publisher.


• Also a book may have more than one author.
• An instructor may write reviews about the books he/she has ordered
Document Entity Types for Instructor
Entity Name Desccription Aliases Occurence

Course Courses offered An instructor


by a department may offer books
for a courses

Author Author of a Book writer An author writes


a book
• 1.2 Identify relationship types
Instructor : Book has authors
Book has a publisher

Online Customer : customer places order


order contains one or more books

Determine Relationship cardinalities and optionalities (participation constraint)

Use Entity Relationship Modeling


Document relationship types
Hint: Check verbs
1.2 Identity Relationship Types!
What is a relationship?
They show the associations among entity types. i.e. Relate one entity to another entity.

• Instructor –Data Requirements


• Each instructor may order at the most 10 text or reference books each semester.
• For each text/reference book ordered, the instructor specifies the course and the
number of students who will be taking the course.
• Each course has a unique coursecode, a title. An instructor may teach many courses.

• Each book has a title, a unique ISBN number and a publisher.


• Also a book may have more than one author.
• An instructor may write reviews about the books he/she has ordered
Document Relationship Types for Instructor
Entity Type Relationship Type Entity Type Cardinality Participation
Ratio

Book Written By Author M:N T:T


has Publisher 1:M T:T

Review Written For Book M:1 P:T


• 1.3 Identify and associate attributes with entity or relationship types.
Instructor : textbook : title, isbn, publishername
course : coursecode, title
Director of Bookstore :
Book: title, isbn
Publisher : name, code
Document attributes
Hint: Check nouns
1.3 Identity Attributes and Associate with Entity andRelationship Types!
What is an attribute?
attribute describes the elementary features of an entity

• Instructor –Data Requirements


• Each instructor may order at the most 10 text or reference books each semester.
• For each text/reference book ordered, the instructor specifies the course and the
number of students who will be taking the course.
• Each course has a unique coursecode, a title. An instructor may teach many courses.

• Each book has a title, a unique ISBN number and a publisher.


• Also a book may have more than one author.
• An instructor may write reviews about the books he/she has ordered
Document Attributes for Instructor
Entity/Relationship Attribute Description Data Type and Constraint Default Alias Null? Derived?
Type Length Value
Staff Name First Name Staff first name Char(25) No
Last Name Staff last name Char(25) No
SID Staff unique no Varchar2(7) PK
OFFICE NO Staff office no Varchar2(5)
E-mail e-mail address of staff Varchar2(20)
Phone_NO Staff phone no Number(11)
Title Staff prefix Char(15)
Status
Office hour Staff office hour
Picture Staff photo Varchar2(5)

Department D_no Department unique no Number(2) PK


Name Department name Char(25)
D_code Deptcode to use in Char(4) AK
coursecodes
• 1.4 Determine Attribute domains

Document attribute domains


• 1.5 Determine candidate and primary keys
Draw
Document keys ERD

• 1.6 Consider use of enhanced modeling concepts (optional step)


• Specialize/generalize entity types
• Composition/aggregation
• 1.7 Check model for redundancy

• 1.8 Validate conceptual model against user transactions

• 1.9 Review local conceptual data model with user

You might also like