17
Microsoft Access - PA Harris, Vanderbilt Universi Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research Informatics Oct 07, 2010

Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

Embed Size (px)

Citation preview

Page 1: Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

Microsoft Access -

PA Harris, Vanderbilt University

Crash CourseA Primer for Relational Database

Design and Use

Paul A. Harris, Ph.D.Office of Research Informatics

Oct 07, 2010

Page 2: Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

What is Microsoft Access?

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 application queries.

Other examples of DBMS applications include:

•Oracle•MySQL•SQL Server (Microsoft)•DB2 (IBM)•Informix

PA Harris, Vanderbilt University

Page 3: Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

Why choose MS-Access over SPSS / Excel?Although there is always overlap, the following rules might help when deciding when / when not to use MS Access:

•MS Access is best used for long-term data storage and/or data sharing.

•MS Excel is best used for minor data collection, manipulation, and especially visualization.

•SPSS is best used for minor data collection and especially data analysis.

It is easy to export data from MS Access to Excel SPSSPA Harris, Vanderbilt University

Page 4: Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

Why choose MS-Access over other DBMS systems?

Cheap, readily available (packaged with MS-Office Premium).

Easy to use (relative to other systems –Oracle may require one FTE to maintain the server as a database administrator and another FTE to serve as an application developer).

Includes front-end tools for rapid application development (RAD). This also makes MS-Access a good prototype environment.

PA Harris, Vanderbilt University

Page 5: Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

Why choose other DBMS systems over MS-Access?

MS-Access can handle a large number of records, but is somewhat slow compared to some of the high-end platforms.

Multiple users may use the database simultaneously, but MS-Access is known to become unstable with greater than 3-5 users. Security can also be a factor.

There is a “snob factor”. I personally recommend the use of other systems (Oracle, SQL Server, mySQL, etc) when writing grant proposals - especially phase II type grants.

PA Harris, Vanderbilt University

Page 6: Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

What is in an MS-Access file?

Demographics Ethnicity Labs H & P

Tables

Queries

Forms (Active)Reports (Static)

VB + Macros – Event Driven Automation, etc.

PA Harris, Vanderbilt University

Page 7: Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

Advanced – Splitting

PA Harris, Vanderbilt University

Back-End File - Contains all Data Tables

VB + Macros – Event Driven Automation, etc.

Demographics Ethnicity Labs H & PTables

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.

Page 8: Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

Front-EndExample

PA Harris, Vanderbilt University

Page 9: Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

Query By Design (GUI Interface)

Demonstrate GUI Query By Design ‘Wizard’ in MS Access.

Demonstrate SQL window after building through GUI.

Make changes in SQL and watch GUI parameters change.

Page 10: Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

One Table Query Example

Right-Click + Add to add table(s)

Use this button to toggle between design, sheet and SQL views.

Custom sort by one or more fields.

Drag and Drop Fields

Page 11: Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

Query – Sorting Data

Choose Ascending or Descending in the Sort Row

This query would sort by Gender THEN by Race.

Page 12: Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

2-Table Query Example

Drag and Drop Fields

Right-Click + Add to add table(s)Note that relationship often automatic.

Calculated Field

BMI: [Weight]/([Height]/100)^2

Right-Clicking gray area above field enables property changes.

SHOW JOIN PROPERTIES HERE

Page 13: Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

Query – Calculating Fields

Name the calculated field, then type a colon, then type the 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

Page 14: Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

Query – Filtering Data

You

nee

d no

t “sh

ow”

the

data

fie

ld to

use

as

a fi

lter

.

This query will return ID, age and BMI values for all males (Gender = 1) between the age of 30 and 60 years old who have a measured BMI greater than or equal to 20.

Page 15: Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

Query – Filter Operators= equals> greater than>= greater than or equal< less than<= less than or equal<> not equal toBetween between two valuesIs Null field is emptyis not null field is not emptyLike Matches a pattern (Like John*)OR Logical OR (one or other is true)AND Logical AND (both are true)etc.

Page 16: Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

Query – Export Data

Create and Save Query

1)

Use OfficeLinks (Excel Toggle Option) to “Analyze it with Excel”

2)

Data Automatically Exported to Excel

3)

PA Harris, Vanderbilt University

Page 17: Microsoft Access - PA Harris, Vanderbilt University Crash Course A Primer for Relational Database Design and Use Paul A. Harris, Ph.D. Office of Research

REDCap Locally: https://starbrite.vanderbilt.edu

http://www.project-redcap.org/