relationships among access database objects

13
- 1 - Table s Query (View ) Form Repor t Database Application Basic Database Object Relationships among Access Database Objects A saved SELECT query is officially called a View in SQL. QUERY in Access can be SELECT, INSERT, UPDATE, or DELETE. You can create a query against a table or a query. You can create a form or report against a table or a query. SQL : Structured Query Languag R R DBMS : Relational Data Base Management System DBA : Data Base Administrator DB designer/Data modeler

Upload: kolina

Post on 21-Jan-2016

68 views

Category:

Documents


0 download

DESCRIPTION

Relationships among Access Database Objects. Tables. Database Application. Form. Report. Query (View). Basic Database Objects. SQL : Structured Query Language R DBMS : Relational Data Base Management System DBA : Data Base Administrator DB designer/Data modeler. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Relationships among Access  Database Objects

- 1 -

Tables

Query(View)

Form Report

Database Application

Basic Database Objects

Relationships among Access Database Objects

• A saved SELECT query is officially called a View in SQL. • QUERY in Access can be SELECT, INSERT, UPDATE, or DELETE. • You can create a query against a table or a query.• You can create a form or report against a table or a query.

SQL: Structured Query LanguageRRDBMS: Relational Data Base Management SystemDBA: Data Base AdministratorDB designer/Data modeler

Page 2: Relationships among Access  Database Objects

- 2 -

Database:Tables, Columns, Rows, Primary Keys, Foreign Keysand Relationships

Potential relational database for Coca-Cola Bottling Co.

Page 3: Relationships among Access  Database Objects

- 3 -

Multiple (Dual) Perspectives

DATA ACTIVITY

EMPLOYEE

HIREEMPLOYEE

PAYEMPLOYEE

PROMOTEEMPLOYEE

FIREEMPLOYEE

......

....

......

....

ACMEEnterprise

We do these things

We usethis data

SQL

InsertUpdateDelete Select

CRUD OperationsCreateUpdateDelete Read

UserInterface

Data Process

App.

Page 4: Relationships among Access  Database Objects

- 4 -

Member Agreementis enrolled under;

applies to

Club

established by; established

Member Order

Product Promotionsponsors;

is sponsored byis featured in;

features

generates; generated by

sells; is sold on

placed by; places

Data Model (Entity Relationship Diagram)

Page 5: Relationships among Access  Database Objects

- 5 -

Data Modeling Case StudyThe 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.

5

Page 6: Relationships among Access  Database Objects

- 6 -

Northwind Database

6

Page 7: Relationships among Access  Database Objects

- 7 -

A Business Form

7

Page 8: Relationships among Access  Database Objects

- 8 -

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.

8

Page 9: Relationships among Access  Database Objects

- 9 -

SolutionUnnormalized table

Remove repeating group

1st NF

2nd NF

3rd NF

Remove partial FD

Remove transitive FD

(OrderNo, OrderDate, CustNo, CustAddress, CustType, Tax, TotalTotal)

(OrderNo, ProductNo, Description, Quantity, UnitPrice, SubtotalSubtotal)

(ProductNo, Description, UnitPrice)

(OrderNo, ProductNo, Quantity, UnitPrice, SubtotalSubtotal)

(OrderNo, OrderDate, CustNo, Tax, TotalTotal)(CustNo, CustAddress, CustType)

(OrderNo, OrderDate, CustNo, CustAddress, CustType, Tax, TotalTotal, 1{ProductNo, Description, Quantity, UnitPrice,Subtotal}n)

9

Page 10: Relationships among Access  Database Objects

- 10 -

SELECT COURSE.C_ID, COURSE.TITLE, COURSE.FEE

FROM COURSE

WHERE (((COURSE.FEE)>250 And (COURSE.FEE)<=350))

ORDER BY COURSE.FEE DESC;

SQL Select and Query Design in Access

Page 11: Relationships among Access  Database Objects

- 11 -

JOIN and Aggregation Function Show students ID, name, and GPA SELECT STUDENT.S_NO, STUDENT.NAME,

Round(Avg(REGISTRATION.GRADE)*100)/100 AS AvgOfGRADEFROM STUDENT INNER JOIN REGISTRATION ON STUDENT.S_NO =

REGISTRATION.S_NOGROUP BY STUDENT.S_NO, STUDENT.NAME;

Or Format(Avg(REGISTRATION.GRADE), "###.00") AS AvgOfGRADE

Page 12: Relationships among Access  Database Objects

- 12 -

Database(Access) vs. Spreadsheet (Excel)Features Database Excel

Multi-user concurrent access/update to the data

Volume of the dataComplex relationships of various dataCalculation /formula among various data itemsBusiness graph capabilityApplications development tools

Page 13: Relationships among Access  Database Objects

- 13 -

http://www.oracle.com/tools/jdeveloper/documents/jsptwp/index.html?content.html

Auction Web Site's Data Model