28
WEEK 11 Database Design

WEEK 11 Database Design. TABLE INSTANCE CHARTS Create Tables

Embed Size (px)

Citation preview

WEEK 11

Database Design

TABLE INSTANCE CHARTS

Create Tables

TYPES OF DATA

Common Data Types in Access

• Autonumber• SHORT Text• LONG Text• Number• Currency• Date/Time• Yes/No

Autonumber

• Use for unique sequential numbering• Commonly used for PK (Primary Key)• Increments by 1• Automatically inserted when a record is added.

SHORT Text

• Used for text or combinations of text and numbers, such as addresses, or for numbers that do not require calculations, such as phone numbers, part numbers, or postal codes.

• Stores up to 255 characters.

LONG Text

• Use for lengthy text and numbers, such as notes or descriptions.

• Should be used “sparingly”, because it takes up too much room in database

• Stores up to 65,536 characters (if not more)

Number

• Use for data to be included in mathematical calculations, except calculations involving money (use “Currency” type). • When you are creating a RELATIONSHIP with an

“AUTOnumber” field with the “PARENT” table

Yes/No

• Use for data that can be only 1 of 2 possible values, such as • Yes/No, • True/False, • On/Off.

• Null values are NOT allowed

Rule

• One chart completed for each table

• Click here to open: “TableInstanceChart.xlsx”

Review Relationship Essentials• Need a primary key• EVERY TABLE NEEDS A PRIMARY KEY• Should be 1st field

• Need a foreign key• a Foreign Key is a column in a table used to reference a

Primary Key in another table.• A table does NOT necessarily have to have a Foreign Key• Whenever you see: “MANY”—this will be the Foreign

Key

• Primary key and foreign keys are essential when you create relationships that join together multiple tables in a database

CREATE TABLES IN MS ACCESS

COMPACTING & REPAIRING A DATABASE

• DATABASE TOOLS > COMPACT & REPAIR button• •As you add, edit, & delete objects, a

database changes in size• •To minimize the size of a database & improve

performance should be done on a regular basis• •Rearranges how a fragmented database is

stored on disk

Want More Information

• If you would like more information on how to use MS Access, click here

QUERIES

• Is a QUESTION to the database-asking for a “set of records” from 1 or more Tables/QueriesMS Access responds by displaying the requested datais a stored question, rather than a stored responseresults automatically update,IF table is edited, it allows you to view & operate on “selected subsets” of your data

QUERIES: DEFINITION

Single Table Queries

• Select fields to display• Sort by?• Simple Conditions• When you enter text into the criteria cell your

text should be enclosed in quotes ("") to distinguish it from other expressions and operators that you may need to add.

WORKING WITH TEXT

Matching Text

OR Statement

IN Statement

NOT Statement

NOT IN Statement

LIKE “Text*” Statement

LIKE “*Text” Statement

Hybrid / Homework

View “14 Week Schedule” > Week 11 > 3rd Column