Download presentation
Presentation is loading. Please wait.
Published byDamian Watkins Modified over 9 years ago
1
Introduction to Access BUS 782
2
Creating a New Database MS Office button/New –Blank database –New database name and location
3
Access Objects Tables –Create a new table: Create/Table Design –Open a table: Double click the table name –Home/View: Datasheet view Design view Queries –Create a new query: Create/Query Design Others: Forms, Reports, Pages
4
Creating a Table Create/Table Design: –Field name –Field data type Create table by using table templates –Create/Table Templates/select template Create a primary key –Never let Access to create a primary key for you. Enter data
5
Create a new Query Create/Query design/Show table –Select fields –Add criteria Sorting Total and subtotal –Query design tools/Total –A Total row is added to the design view –Select function from the total row’s dropdown list
6
Creating a New Form Using Form Wizard –Create/More Forms/Form Wizard
7
Querying Database
8
Basic Query Language Operations Selection Projection Join Aggregates: Max, Min, Sum, Avg, Count –Totals and SubTotals –GroupBy Calculated fields
9
Selection Selection operation retrieves records that satisfy user’s criteria.
10
Projection Projection operation defines a vertical subset of a table and retrieves only the specified fields.
11
Join The two tables must have common attributes: –Key and foreign key. Combines two tables to form a new table where records of the two tables are combined if the common attributes have the same value.
12
Join Example Faculty File: FIDFname F1Chao F2Smith F5Boxer Student File: SIDSname FID S1PeterF1 S2PaulF2 S3SmithF1 Faculty Join Student =
13
Join Example Student File: SIDSname FID S1PeterF1 S2PaulF2 S3SmithF1 StudentCourse File: SIDCID S1ISYS263 S1Acct101 S3ISYS363 S2ISYS263 S2Fin350 S2Acct101 Course File: CIDCname Units ISYS263 IS Intro3 ISYS363 MIS Intro3 Acct101accounting3 Fin350Finance Intro3 (Student Join StudentCourse) Join Course
14
Aggregate Functions Max, Min, Sum, Count, Avg View/Totals Ex. Student: SID,Sname, GPA, Sex, Major –How many students in this University? –What is the overall average GPA?
15
Aggregates by Group –How many students in each major? –Compare male students and female students average GPA.
16
Examples Customer: CID, Cname, City, Rating Orders: OID, Odate, SalesPerson, CID Queries: –Find customers live in San Francisco. –Produce a customer report that shows CID, Cname, and Rating. –Number of customers in each city City, NumbeOfCustomers –Produce a report that shows the number of orders for each customer: CID, Cname, TotalNumberOfOrders
17
University Database
18
ERD Notations Student Account Faculty Course Has 11 Enroll MM Advise M 1 Teach M M SID Sname Major SID Balance FID Fname CID Cname Units Phone Grade
19
Examples Q1: Display students’ ID, name and account balance who owe university more than $2000. Q2: Display student’s ID, name and total units. Q3: Find students taking at least 9 units and display their ID, Name and total units. Q4: Display CID, Cname, SID, Sname Q5: Display CID, Cname, number of students in each course. Q6: Display faculty’s name and phone if the faculty advises at least three students.
20
Order Processing Database Examples Order Processing Database: –Customer, Orders, OrderDetail, Product –MIS report –Total amount for each order –Criteria applied to subtotal
21
Calculated Fields Rename a field: –NewName:OldName Define a calculated field: –Tax:salary*.15 –Age:Year(Now()) – Year(DOB) –IIF function
22
Criteria >, >=, Range: BETWEEN 1/1/03 AND 12/31/03 Wildcard: –? – match any one character “K?NG” –* - Match any number of characters “C*”
23
Complex Condition University admission rules: Applicants will be admitted if meet one of the following rules: –1. Income >= 100,000 –2. GPA > 2.5 AND SAT > 900 How to enter this complex condition?
24
Scholarship: Business students with GPA at least 3.2 and major in Accounting or CIS qualified to apply: –1. GPA >= 3.2 –2. Major in Accounting OR CIS How to enter this complex condition?
25
Complex condition examples Rating = “A” OR Rating = “B” Cname = “Chao” OR Cname = “Smith” Rating = “A” OR Rating = “B” AND City=“SF” (Rating = “A” OR Rating = “B”) AND City=“SF”
26
Sorting One field sorting Two fields sorting
27
Other Queries Update query: –Query tools/Design/Query type/Update Delete query Parameter query CrossTab query –Crosstab row
28
Access Tools for Import/Export Import from Excel: –The first row of Excel’s list should contain field names –External Data/Import/Excel Export to Excel: –External Data/Export/Excel
29
Open Database Connectivity (ODBC) Provide a standard to retrieve data from a database. It manages one or more "database drivers“ that enables the communication between database and applications. To access a database, we use ODBC facilities to define a ODBC data source name for the database.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.