Download presentation
Presentation is loading. Please wait.
Published byBrandon Cox Modified over 9 years ago
1
Introduction to Access ISYS 363
2
Access Objects Tables –Open –Design –New –Wizard Queries Forms Reports Pages
3
Creating a Table Create table in design view –Field name –Field data type Create table by using wizard Create a primary key Enter data
4
Demo Queries Forms
5
Querying Database ISYS 363
6
Basic Query Language Operations Selection Projection Join Aggregates: Max, Min, Sum, Avg, Count –Totals and SubTotals –GroupBy Calculated fields
7
Selection Selection operation retrieves records that satisfy user’s criteria.
8
Projection Projection operation defines a vertical subset of a table and retrieves only the specified fields.
9
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.
10
Join Example Faculty File: FIDFname F1Chao F2Smith Student File: SIDSname FID S1PeterF1 S2PaulF2 S3SmithF1 Faculty Join Student =
11
Join Example Student File: SIDSname FID S1PeterF1 S2PaulF2 S3SmithF1 StudentCourse File: SIDCID S1ISYS263 S1Acct101 S3ISYS363 S2ISYS263 S2Fin350 S2Acct101 Course File: CIDCname Units ISYS263 IS IntroPeter3 ISYS363 MIS IntroPaul3 Acct101accounting3 Fin350Finance Intro3 (Student Join StudentCourse) Join Course
12
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?
13
Aggregates by Group –How many students in each major? –Compare male students and female students average GPA.
14
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
15
University Database
16
Examples Q1: Display students’ ID and name who owe university more than $2000. Q2: Display faculty’s name and phone if the student advised by the faculty has GPA lower than 2.0. Q3: Display faculty’s name and phone if the faculty advises at least three students. Q4: Display students’ ID, name and the total units taking.
17
Order Processing Database Examples Order Processing Database: –Customer, Orders, OrderDetail, Product –MIS report –Total amount for each order –Criteria applied to subtotal
18
Calculated Fields Rename a field: –NewName:OldName Define a calculated field: –Tax:salary*.15 –Age:Year(Now()) – Year(DOB) –IIF function
19
Criteria >, >=, Range: BETWEEN 1/1/03 AND 12/31/03 Wildcard: –? – match any one character “K?NG” –* - Match any number of characters “C*”
20
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 An applicant’s Income is 150,000, GPA is 2.9 and SAT is 800. Admitted? –Income >= 100,000 OR GPA > 2.5 AND SAT >900 How to evaluate this complex condition?
21
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 Is a CIS student with GPA = 2.0 qualified? –GPA >= 3.2 AND Major = “Acct” OR Major = “CIS” Is this complex condition correct?
22
NOT Set 1: Young: Age < 30 Set 2: Rich: Income >= 100,000 YoungRich
23
Order of Evaluation 1. () 2. Not 3. AND 4. OR
24
Examples SAT = 800, Income 60,000, GPA 3.0, admitted? –(SAT > 900 OR Income >= 50,000) AND Not GPA < 2.5 A=2, B=3 (A=3 OR NOT (B < A)) AND B=A+1
25
Excel’s IF with Complex Condition Rules to calculate employee bonus are: –If JobCode = 1 AND Salary < 5000 Bonus = 10% * Salary –Otherwise: Bonus = 8% * Salary Rules to calculate employee bonus are: –If JobCode = 1 AND Salary < 5000 OR Sex = “F” Bonus = 10% * Salary –Otherwise: Bonus = 8% * Salary
26
Access Complex condition 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”
27
Sorting One field sorting Two fields sorting
28
Other Queries Update query Delete query Parameter query CrossTab query
29
Forms Form wizard Main/Sub Form –Based on two tables with 1:M –Based on a query created from two tables with 1:M Pivot Table form –AutoCal
30
Access Tools for Import/Export File/Get External Data File/Export
31
Excel’s Database Tools Data –Sort –Filter –Subtotals –Pivot table/Pivot chart OLAP: On Line Analytical Process DrillDown, RollUp, ReAggregation –Import external data Import data New web query New database query
32
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.
33
Data/Import External Data New Database Query Select and click OK.
34
Web Query Data/Import External Data/New web query Click table on the web page Use the Save Query button to save web query Web query can be refreshed. Copy/Paste can not.
35
Import Data Data/Import External Data/Import Data
36
Data Consolidation Help, F1
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.