Download Data Modeling Case Study

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

Operational transformation wikipedia , lookup

Expense and cost recovery system (ECRS) wikipedia , lookup

Data center wikipedia , lookup

Microsoft Access wikipedia , lookup

Data analysis wikipedia , lookup

Data model wikipedia , lookup

Concurrency control wikipedia , lookup

PL/SQL wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Information privacy law wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

SQL wikipedia , lookup

SAP IQ wikipedia , lookup

Business intelligence wikipedia , lookup

Open data in the United Kingdom wikipedia , lookup

Database wikipedia , lookup

Data vault modeling wikipedia , lookup

Versant Object Database wikipedia , lookup

Clusterpoint wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
Database Introduction
Class
Enrollment
program
Payroll
System
Database
DBMS
DBMS
Database
E-commerce
Website
• RDBMS: Relational Data Base
Management System
• SQL: Structured Query
Language
• DBA: Data Base Administrator
• DB Designer/Data Modeler
Query or
Reporting
Tools
-1-
Multiple (Dual) Perspectives
We use
this data
ACME
Enterprise
DATA (Information)
We do
these things
CRUD
SQL Operations
Activity(Operation)
HIRE
EMPLOYEE
Insert
Update
Delete
Select
PAY
EMPLOYEE
Create
Read
Update
Delete
User
Interface
App.
......
......
....
....
EMPLOYEE
(Resource)
PROMOTE
EMPLOYEE
FIRE
EMPLOYEE
Data
Process
-2-
Database Tables
-3-
3
SQL Select and Query Design in Access
SELECT COURSE.C_ID, COURSE.TITLE, COURSE.FEE
FROM COURSE
WHERE (((COURSE.FEE)>250 And (COURSE.FEE)<=350))
ORDER BY COURSE.FEE DESC;
-4-
Relationships among Access Database Objects
Basic Database Objects
Database Application
Form
Report
Tables
Query
(View)
• QUERY in Access can be SELECT, INSERT, UPDATE, or DELETE.
•
•
•
A saved SELECT query is officially called a View in SQL standard. When
you save a query, you save the definition of the query, not the query result.
You can create a query against a table or a query.
You can create a form or report against a table or a query.
-5-
Database:
Tables, Columns, Rows,
Primary Keys, Foreign Keys
and Relationships
Potential relational database
for Coca-Cola Bottling Co.
-6-
Data Model (Entity Relationship Diagram)
Member
Order
sells;
is sold on
Product
placed by;
places
Member
is enrolled under;
applies to
established by;
established
generates;
generated by
is featured in;
features
Agreement
Promotion
sponsors;
is sponsored by
Club
-7-
Data Modeling Case Study
The following is description by a pharmacy owner:
"Jack Smith catches a cold and what he suspects is a flu virus.
He makes an appointment with his family doctor who confirm
his diagnosis. The doctor prescribes an antibiotic and nasal
decongestant tablets. Jack leaves the doctor's office and drives
to his local drug store. The pharmacist packages the
medication and types the labels for pill bottles. The label
includes information about customer, the doctor who prescribe
the drug, the drug (e.g., Penicillin), when to take it, and how
often, the content of the pill (250 mg), the number of refills,
expiration date, and the date of purchase."
Please develop a data model for the entities and
relationships within the context of pharmacy. Also
develop a definition for "prescription". List all your
underlying assumptions used in your data models.
-8-
8
Northwind Database
-9-
9
A Business Form
10
- 10 -
An Informal Example of Normalization
• A CUSTOMER ORDER contains the following information:
–
–
–
–
–
–
–
–
OrderNo
OrderDate
CustNo
CustAddress
CustType
Tax
Total
one or more than one Order-Item which has
•
•
•
•
•
ProductNo
Description
Quantity
UnitPrice
Subtotal.
11
- 11 -
Solution
Unnormalized table
(OrderNo, OrderDate, CustNo, CustAddress, CustType, Tax, Total,
1{ProductNo, Description, Quantity, UnitPrice,Subtotal}n)
Remove repeating group
1st NF
(OrderNo, ProductNo, Description, Quantity, UnitPrice, Subtotal)
Remove partial FD
2nd NF
(OrderNo, OrderDate, CustNo, CustAddress, CustType, Tax, Total)
Remove transitive FD
(OrderNo, ProductNo, Quantity, UnitPrice, Subtotal)
(ProductNo, Description, UnitPrice)
3rd NF
(OrderNo, OrderDate, CustNo, Tax, Total)
(CustNo, CustAddress, CustType)
12
- 12 -
JOIN and Aggregation Function
Show students ID, name, and GPA
SELECT STUDENT.S_NO, STUDENT.NAME,
Round(Avg(REGISTRATION.GRADE)*100)/100 AS AvgOfGRADE
FROM STUDENT INNER JOIN REGISTRATION ON STUDENT.S_NO =
REGISTRATION.S_NO
GROUP BY STUDENT.S_NO, STUDENT.NAME;
Or Format(Avg(REGISTRATION.GRADE), "###.00") AS AvgOfGRADE
- 13 -
Database(Access) vs. Spreadsheet (Excel)
Features
Database
Excel
Multi-user concurrent
access/update to the data
Volume of the data
Complex relationships of
various data
Calculation /formula among
various data items
Business graph capability
Applications development
tools
- 14 -
http://www.oracle.com/tools/jdeveloper/documents/jsptwp/index.html?content.html
Auction Web
Site's Data Model
- 15 -