ms access ism
TRANSCRIPT
-
7/27/2019 Ms Access Ism
1/42
-
7/27/2019 Ms Access Ism
2/42
Basics DBMS : Data Base Management Systems.
DBMS: An abstraction of an enterprise related to anenterprise
It is used to store data of the enterprise
Data: Transactional Data and other type of data
DBMS: Allows enterprise to store, retrieve, update, delete and backup the data.
Life Cycle of Data: C Store, Retrieve, Update, Backup and
Delete
The alternative to DBMS was File System
In File System, data are stored in one or more data files.
Data Files can be of different types.
-
7/27/2019 Ms Access Ism
3/42
Basics Problem with File System
Redundancy of Data Same data in different files Access through Programmers (no SQL like access)
Sharing data among different users is difficult Explicit lockingby programmers
Difficult to answer adhoc queries
Many data files are created. Explosion of files
Update problems
No centralized control
Access controls has to be implemented by programmers
Files are created for specific purposes in most cases as suchare specific for the purpose for they are created
Time to develop applications
-
7/27/2019 Ms Access Ism
4/42
Basics DBMS
Designed taking into account enterprise view Centralized Control
Access Controls enforced by DBMS
Reduce Data Redundancy
Developed for Data Sharing
SQL can be used to store data, retrieve data and update data
Automatic backup and recovery features
Programming Languages access through standardized DBMS
interface
Easy to applications. Many tools are available
Manage large volume of data
-
7/27/2019 Ms Access Ism
5/42
RDBMS Relational Data Base Management System (RDBMS)
RDBMS: It views data as collection of tables. A Table has row and columns (two dimensional structure)
Entity Relationship Diagrams are used to model tables
A row represents record
A column represent an attribute
Primary Key
Different tables can be related by table values Primary Keys,
Foreign Keys
RDMS Design: Reduce data redundancy and update anomalies
Data Normalization
Referential Integrity
-
7/27/2019 Ms Access Ism
6/42
MS Access MS Access is part of MS Office
It can be used to store data As such there is overlap with some other products available in
MS Office and from other vendors
Although there is always overlap, the following rules mighthelp when deciding when / when not to use MS Access:
MS Access is best used for long-term data storage and/or datasharing.
MS Excel is best used for minor data collection, manipulation,and especially visualization.
SPSS is best used for minor data collection and especially dataanalysis.
It is easy to export data from MS Access to Excel SPSS
-
7/27/2019 Ms Access Ism
7/42
MS Access Cheap, readily available (packaged with MS-Office Premium).
Easy to use (relative to other systems )
Easy to use Interface
Wizards
Oracle may require one Engineer to maintain the server as a
database administrator
It also requires another engineer to serve as an application
developer
MS Access Includes front-end tools for rapid application
development (RAD). This also makes MS-Access a good
prototype environment.
All programming languages can use it.
-
7/27/2019 Ms Access Ism
8/42
-
7/27/2019 Ms Access Ism
9/42
MS Access Although the term database typically refers to a collection
of related data tables, an Access database includes more thanjust data.
In addition to tables, you can add:
Saved queries (stored procedures) - organizing and/or
manipulating data Forms gui interaction with data, event programming
Reports customized results for printing (~ static forms)
Macros and VB programs for extending functionality
Microsoft provides some logical integration of these toolsthrough wizards. However, these are pretty basic - mostdevelopers must pick and choose the best approach whenimplementing applications.
-
7/27/2019 Ms Access Ism
10/42
MS- Access File
Unless advanced techniques are
employed, all entities are stored
in one *.mdb file. When
running, a locking file (*.ldb) is
also visible. Only the mdb file
needs to be copied to transferthe database to another
computer or location.
Ex.MSCI_ByrneGuestLecture.mdb
-
7/27/2019 Ms Access Ism
11/42
MS Access File
Demographics Ethnicity Labs H & P
Tables
Queries
Forms (Active)Reports (Static)
VB + Macros Event Driven Automation, etc.
-
7/27/2019 Ms Access Ism
12/42
Applications
Back-End File - Contains all Data Tables
VB + Macros Event Driven Automation, etc.
Demographics Ethnicity Labs H & P
Tables
Queries
Forms (Active) Reports (Static)
Front-End File - Contains all Application Entities (Forms, Queries, etc.) and links to
data tables in back-end file. Note you may have more than one FE to
accommodate different user types.
-
7/27/2019 Ms Access Ism
13/42
MS Access and Objects
Relational data model
Data is stored in tables incorporated into databasefiles with extension mdb or accdb
Standard Windows interface
Standard Help system
Part of MS Office suite
Tables contain rows called records and columns calledfields.
Queries are requests for specific information from adatabase.
Queries are virtual tables built on a given SQL statement
-
7/27/2019 Ms Access Ism
14/42
MS- Access Objects Forms are parts of user interface. Forms are used to enter, edit or
browse data from a database Reports present requested information and allow to create hard
copies.
Microsoft Access is a relational database management system(DBMS or RDBMS). At the very core, it is a software engine that
provides an interface between physical data and user applicationqueries.
Other examples of DBMS applications include:
Oracle
mySQL
SQL Server (Microsoft)
DB2 (IBM)
Informix
-
7/27/2019 Ms Access Ism
15/42
Tables Overview
Think of Access as a collection of
spreadsheets that are relationally linked.
STOREDATAON
ETIME/ONEPLA
CE
DONOTSTORECALCULATEDDATA
Demographics
Patient_IDFname
Lname
Address
Phone
Gender
RaceDOB
Height
Glucose
Glucose_IDPatient_ID
Date
Weight
Med_ID
Glucose
Meds
Med_IDDrugCombonation
-
7/27/2019 Ms Access Ism
16/42
Data Types
Text
Memo
Numbers
Byte
Integer
Long integer
Single
Double
Date/time
Currency
AutoNumber
Yes/No
Yes/no
True/False
1/0
OLE Objects
Hyperlink Lookup Wizard
-
7/27/2019 Ms Access Ism
17/42
Create Table Click on the round Office button
Choose Newfrom the drop-down menu
In Create Blank Database window specify the database name
Click Create
Using Wizard
Design View
Specify field names
Data types
Properties Determine a primary key
Save the table
-
7/27/2019 Ms Access Ism
18/42
Access Tables and Constraints Design view
Table structure is created and may be edited Datasheet view
Display table content in spreadsheet-like grid,
Used for entering, editing or deleting data from tables
Referential Integrity
Can be established or removed in Relationship window In MS Access 1995-2003 open menu Tools and choose
Relationships from the drop-down menu
In MS Access 2007 and up choose Database Tools tab and thenRelationships
Use drag-and-drop features and select Enforce Referential Integrityoption
Tip specify referential integrity constraints before data is entered
-
7/27/2019 Ms Access Ism
19/42
Tables
General Setup for Tables
Describe General Options
Show Validation Rule
Relationships
Lookup Option
-
7/27/2019 Ms Access Ism
20/42
Tables
Table Relationships
Describe Cascade Features
-
7/27/2019 Ms Access Ism
21/42
Table Import
Importing a Table makes a copyof existing data
Linking a Table lets you control
existing data through Access
(Exercise Caution !)
Note that you may
import non-Access
files.
-
7/27/2019 Ms Access Ism
22/42
Tables Data storage principles
Attempt to store data 1 time / 1 place; Do not store data that may be calculated from other fields
(utilize queries); and
Strive for very discrete data storage (no ambiguity garbage
in / garbage out). Choose real or arbitrary (autonumber) unique identifier for
each record.
Relationships
Use table relationships to automatically cascade delete andupdate records.
Other Data Sources
Import = Copy; Link
-
7/27/2019 Ms Access Ism
23/42
Query
Specify the source of data
If multiple tables are used, specify relationships between tables
Select desirable fields from the table(s) and options related to the
fields
Specify a criterion
To be selected a record must satisfy a criterion
Expressions may contain the following operators:
Math Operators
Relational operators
Boolean Operators
String Operators
Miscellaneous Operators
-
7/27/2019 Ms Access Ism
24/42
Math Operators
+ Addition
- Subtraction
* Multiplication/ Division
\ Integer Division
^ ExponentiationMod Modulo (remainder) division
-
7/27/2019 Ms Access Ism
25/42
Relational Operators
= Equal
Not equal< Less than
> Greater than
= Greater than or equal to
-
7/27/2019 Ms Access Ism
26/42
Boolean Operator
And Logical And Both operands are true
Or Logical Or Either one of the
operands or both ofthem are true
Xor Excusive Or Only one of the
operands (not both ofthem) are true
Not Negation Operand is not true
-
7/27/2019 Ms Access Ism
27/42
String and Miscellaneous Operators
& Concatenation
Like Similar to
Betweenand
Between 2 values inclusive
In (list) One from the listIs Null True if the field is empty
-
7/27/2019 Ms Access Ism
28/42
Query Queries Retrieve Data
SQL (Structured Query Language) is a very widely useddatabase language designed specifically for communicatingwith databases
SQL is not proprietary almost every DBMS supports SQL(including MS-Access).
An MS-Access query is a set of stored SQL instructions thatmanipulate and/or select data from one or more tables.
Select Query Data grouping and/or filtering
Make-Table Query Select + creates/populates new table.
Update Query Updates fields from specified table data
Append Query Runs query on one table, appends results toa table
Delete Query Delete selected records from table
-
7/27/2019 Ms Access Ism
29/42
Query SQL is relatively easy to learn, but extremely powerful
One of the easiest ways to learn is to use MS-Access Query by
Example methods (QBE), It also generates corresponding SQL Statement .
After QBE one can look at the generated SQL command
Remember that a query is nothing more than the database enginerunning the stored SQL command
It looks and sometimes acts like a table, but really adds little massto the database file.
In Query, Name the calculated field, then type a colon, then typethe equation using brackets ( [ ] ) around table fields.
If there is ambiguity in the field names between tables, you may
need to type table.[field] format. Ex: BMI: [Weight]/([Height]/100)^2
Select , Insert , Delete, Update with where
-
7/27/2019 Ms Access Ism
30/42
Query Sorting Data
Choose Ascending or Descending in the Sort Row
This query would sort by Gender THEN by Race.
-
7/27/2019 Ms Access Ism
31/42
Query Filtering Data
This query will return all records in the database for:Females
who are not white
whose height are greater than 150 cm
and who weigh between 60 and 70 kg
Youneednotshow
thedatafieldto
useasafilter.
-
7/27/2019 Ms Access Ism
32/42
Query Grouping Data
Clicking the Totals Button EnablesGrouping, Counting and Statistical Options
Notice new Total row.
Each field (column) can be set.
Running this Query
indicates there are
203 Females and
261 Males in thedatabase.
-
7/27/2019 Ms Access Ism
33/42
Query Grouping Data
Totals Options Include:
Group By
Sum
Avg
Min
Max
Count
StDev
Var
-
7/27/2019 Ms Access Ism
34/42
Query Export Data
Create and Save Query1)
Use OfficeLinks (Excel Toggle Option) to
Analyze it with Excel2)
Data Automatically Exported to
Excel3)
-
7/27/2019 Ms Access Ism
35/42
Query
Queries are extremely easy to set up/use
They provide an up-to-date snapshot of your data at any time.
Queries may be used to calculate values based upon existing
fields, join fields from separate tables, globally update or
delete data, and export linked/calculated data to external
programs. Different types of joints
The queries are really nothing more than stored SQL
statements that are run upon command. They add little mass
to the file application. If you use MS-Access its important should feature is to import
data and export it.
-
7/27/2019 Ms Access Ism
36/42
FormsAlthough it is possible to enter data directly into a table, onecan enhance data quality by forcing data entry through forms.
Depending upon the type of users, one may wish to set thingsup so they never even see the database window.
In other words, one can design your application so they onlytouch the data through programmed forms.
As an example one see that in case of the glucose databaseearlier slides one can attempt to build a graphical user interfaceto:
Collect Data
Periodically report data through pre-formatted reports
Quit the program
So the user will be unaware of the existence of table
-
7/27/2019 Ms Access Ism
37/42
GUI Forms
Out of Program
-
7/27/2019 Ms Access Ism
38/42
MS Access Forms Create using Form Wizard
Create using Form Design view Specify source of data will be presented by the form
Table
Query
Specify fields related to the form Add labels, titles, graphics and so on
Form Design View : Form Headera place for titles, graphics,additional information
Form Details section the fields used to create a form andcontrol elements related to the fields
Form footera place for any items which will appear at thebottom of the form
-
7/27/2019 Ms Access Ism
39/42
MS Access Forms A Form can be associated with a Table
Must be bound with fields from the source table or query Contain data from correspondent fields, labels or other
controls (like command button) or another form calledsubform
Viewing Forms: Open database
Click Forms tab to display all available forms in the database
Select the form
Select Open
To view data use Form Navigation Tools. To prevent data
Editing, use Locked Property for the Text Boxes
Forms can be used for editing data
The results of query can also be displayed in form
-
7/27/2019 Ms Access Ism
40/42
MS Access Forms and Reports Sub Forms
A Form can have many sub forms
Represent 1:N relationships
To add a subform to a form
Create a form that will be a subform
Click on Subform/Subreport button and then click on a
form where the subform should appear
Specify the source for the subform
Specify the fields to link the form and subform
Reports present table contents or query results in an easily
assimilated format
Reports have Design view and Print Preview
Report Design View is similar to the Form Design view
-
7/27/2019 Ms Access Ism
41/42
Reports Page Header contains data and graphics appearing at the top
of each page
Report Header contains the data and graphics appearing atthe top of the first report page
Detailed section contains data from tables or queries
Page Footer contains the data and graphics appearing at thebottom of every page
Report Footer contains the data and graphics appearing atthe bottom of the last report page
Reports can be of following types
Columnar reports a single record on a page
Tabular reports datasheets: fields from the tables arepresented as columns
Justified reports combine two previous types of the reports
-
7/27/2019 Ms Access Ism
42/42
Creating Reports With a Wizard
Design view:
Specify source for the report . The source is one or more
tables.
A Query can also be specified Select Fields from the Fields List
Add labels Used for titles and captions
The headers can also be described here
The data formatting can also be done
Switch the view to see the result.