Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Introduction

Similar presentations


Presentation on theme: "Database Introduction"— Presentation transcript:

1 Database Introduction
Class Enrollment program Database Payroll System DBMS DBMS Database E-commerce Website Query or Reporting Tools RDBMS: Relational Data Base Management System SQL: Structured Query Language DBA: Data Base Administrator DB Designer/Data Modeler

2 Multiple (Dual) Perspectives
ACME Enterprise We do these things We use this data CRUD Operations Create Read Update Delete SQL Insert Update Delete Select DATA (Information) Activity(Operation) EMPLOYEE (Resource) HIRE PAY PROMOTE FIRE ...... .... User Interface App. Data Process

3 Database Tables

4 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;

5 Relationships among Access Database Objects
Basic Database Objects Tables Database Application Form Report 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.

6 Database: Tables, Columns, Rows, Primary Keys, Foreign Keys and Relationships
Potential relational database for Coca-Cola Bottling Co.

7 Data Model (Entity Relationship Diagram)
Member placed by; is enrolled under; Member Agreement Order places applies to sells; generates; established by; is sold on generated by established is featured in; sponsors; Product Promotion Club features is sponsored by

8 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.

9 Northwind Database

10 A Business Form

11 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.

12 Solution Unnormalized table 1st NF 2nd NF 3rd NF
(OrderNo, OrderDate, CustNo, CustAddress, CustType, Tax, Total, 1{ProductNo, Description, Quantity, UnitPrice,Subtotal}n) Remove repeating group (OrderNo, ProductNo, Description, Quantity, UnitPrice, Subtotal) 1st NF Remove partial FD 2nd NF (OrderNo, OrderDate, CustNo, CustAddress, CustType, Tax, Total) Remove transitive FD (OrderNo, ProductNo, Quantity, UnitPrice, Subtotal) (ProductNo, Description, UnitPrice) (OrderNo, OrderDate, CustNo, Tax, Total) 3rd NF (CustNo, CustAddress, CustType)

13 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

14 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

15 Auction Web Site's Data Model
Auction Web Site's Data Model


Download ppt "Database Introduction"

Similar presentations


Ads by Google