Database
Database
Database
WHAT IS DATABASE?
•TABLES
•FORMS
•QUERIES
•REPORTS
ACCESS TABLES
• COLUMNS (FIELDS) AND ROWS (RECORDS)
• LOOKS LIKE EXCEL SPREADSHEETS
• DIFFER BECAUSE THEY MAINTAIN RELATIONSHIPS
ACCESS FORMS
• SUMMARIZE DATA
• PRINT OUT SELECTED INFORMATION
• CUSTOMIZE REPORTS TO ORGANIZE DATA
• USE ONLY INFORMATION NEED
DATABASE ARE ALL AROUND US
• SCHOOLS KEEP DATA ON STUDENTS
• GOVERNMENT KEEPS DATA ON EARNINGS AND TAXES
• CREDIT INFORMATION IS IN DATABASES
• GROCERY STORES TRACK PURCHASES
• WEBSITE COLLECT USER INFORMATION (COOKIES)
• DATABASES DRIVE THE INFORMATION AGE AND MODERN
ECONOMY
DATABASE CREATION AND
MANAGEMENT
MICROSOFT ACCESS
OVERVIEW OF ACCESS DATABASE
• ONE OF DATABASE MANAGEMENT SYSTEMS
SOFTWARE.
• ACCESS, SQL SERVER, ORACLE, DB 2
• MS ACCESS IS A RELATIONAL DATABASE.
• A COLLECTION OF TABLES THAT ARE
RELATED TO ONE ANOTHER BASED ON A
COMMON FIELD.
RELATIONAL DATABASE
BillingDate Date/Time
InvoiceAmt Currency
ADDING RECORDS TO A TABLE
• ENTER DATA SEQUENTIALLY IN DATASHEET VIEW
• DO NOT JUMP FROM FIELD TO FIELD
• USE TAP KEY TO ENTER DATA
• YOU CAN CREATE A QUERY WHEN YOU NEED ONLY A PORTION OF THE DATA FORM TABLES
(OR EXISTING QUERIES).
• FOR EXAMPLE, YOU MAY ONLY NEED TO SEE CUSTOMERS WHO LIVE IN CA. THE RESPONSE WOULD
BE TO DISPLAY ONLY THE RECORDS WHOSE STATE FIELD MATCHES WITH CA.
• MULTIPLE TABLES OR QUERIES CAN BE USED.
• RESTRICTIONS CAN BE USED
• COMPARISON OPERATORS
• THE DESIGN VIEW IS USED TO SPECIFY THE FIELDS AND RECORDS YOU WANT TO SEE.
THE QUERY DESIGN VIEW WINDOW
Fields used in the query are selected from You can run the query at any
the field list and added to the design grid. time by clicking the Run button.
CREATING A SAMPLE QUERY
000 Choi COB 105 CSUB CA 93311 Scott Choi 5348 09/20/2001
Order Table
OrderNum CustomerNum Paid InvoiceAmt BillingDate
201 107 No 854.00 01/15/2001
Product Table
ProductCode CoffeeName Weight/Size Price Decaf
2301 Colombian Aged Crop 1 lb pkg 7.99
MORE ABOUT A QUERY
• WHEN YOU USE THE QUERY DESIGN WINDOW, YOU USE QUERY BY EXAMPLE (QBE).
• DO NOT INCLUDE ANY UNNECESSARY TABLES OR QUERIES IN DESIGN VIEW OF THE QUERY.
• OTHERWISE, YOU HAVE TO DEAL WITH UNEXPECTED PROBLEMS.
• IN YOUR MIDTERM, YOU WILL BE PENALIZED IF YOU INCLUDE UNNECESSARY TABLES OR QUERIES.
The And
condition.
The Or
condition.
CREATING AND AND OR CONDITIONS
IN THE DESIGN GRID
• GROUP BY OPERATOR
• DIVIDES THE SELECTED RECORDS INTO GROUPS BASED ON THE VALUES IN THE SPECIFIED FIELD
• THOSE RECORDS WITH THE SAME VALUE FOR THE FIELD ARE GROUPED TOGETHER.
• I WOULD LIKE TO KNOW A LIST OF ALL MEMBERS WHOSE LAST NAME BEGINS
WITH P USING FOLLOWING FIELDS; FIRST NAME, LAST NAME, CITY, AND STATE.
• SAVE AS LAST NAMES BEGIN WITH P.
QUERY PRACTICE 3
• I WOULD LIKE TO KNOW THE CLASS NUMBER, LAST NAME, AND MEMBER
NUMBER FOR EACH MEMBER WHO HAS A CLASS NUMBER GREATER THAN OR
EQUAL TO 8900. IN ADDITION, SORT LAST NAMES IN ASCENDING ORDER.
• SAVE AS GREATER THAN OR EQUAL TO 8900.
QUERY PRACTICE 5
• I WOULD LIKE TO KNOW A LIST OF ALL MEMBERS WHOSE LAST NAME THAT
BEGINS WITH A OR A FIRST NAME THAT BEGINS WITH R INCLUDING THE
FOLLOWING FIELDS: FIRST NAME, LAST NAME, CITY, AND STATE.
• SAVE AS NAMES WITH A OR R.
QUERY PRACTICE 6
• I WOULD LIKE TO KNOW THE SUM, AVERAGE, MAX. AND MIN. OF EMPLOYEES
SALARY (THESE FOUR ITEMS MUST ALL APPEAR IN THE SAME QUERY).
• SAVE AS SALARY CALCULATIONS
• I WOULD LIKE TO KNOW THE SUM, AVERAGE, MAX. AND MIN. OF EMPLOYEES
SALARY BASED ON EMPLOYEE TYPE.
• SAVE AS EMPLOYEE TYPE
FORMS
• AFTER KIM LEAVES FOR HER STAFF MEETING, BARBARA ASKS YOU TO
CREATE A FORM FOR THE CUSTOMER TABLE BECAUSE THE STAFF ARE
NOT ALLOWED TO ACCESS THE DATABASE DIRECTLY. THE STAFF
MEMBERS SHOULD BE ALLOWED ONLY FOR ENTERING DATA. BUT,
USING A FORM, THE STAFF CAN WORK DATA EASILY IN THE TABLE.
• DOWNLOAD “RESTAURANT 3” DATABASE AGAIN.
• OPEN CUSTOMER TABLE TO IDENTIFY # OF RECORDS (38)
• CREATE USING “FORM WIZARD”
• LAYOUT: COLUMNAR & STYLE: INTERNATIONAL
• SAVE THE FORM AS TEST FORM
ADDING A RECORD INTO THE FORM
• ADD FOLLOWING INFORMATION AS A RECORD NO.39
CUSTOMER;
• CUSTOMERNUM: 000
• CUSTOMERNAME: YOUR LAST NAME
• STREET, CITY, STATE, AND ZIPCODE: YOUR ADDRESS
• OWNERNAME: YOUR FULL NAME
• PHONE: YOUR PHONE NUMBER
• FIRSTCONTACT: 09/20/2001
• A RECORD NO. 39 ADDED TO THE CUSTOMER TABLE (IT’S
HAS BEEN ALTERED).
MODIFYING A FORM
• MODIFY THE TEST FORM BASED ON BELOW
REQUIREMENTS USING THE DESIGN VIEW OF FORM
• MAKE SURE THAT CITY, STATE, AND ZIP CODE ARE ON THE SAME
LINE
• TITLE OF FIELD: LABEL BOX
• ACTUAL ENTRY SPACE: TEXT BOX
• IN ORDER TO MOVE BOTH BOXES TOGETHER, PLACE THE CURSOR
BETWEEN LABEL AND TEXT BOXES. THEN, THE SHAPE OF CURSOR
WILL BE CHANGED TO A BLACK COLORED HAND.
MODIFYING A FORM (CON’T)
• THE LABELS FOR FIRST NAME, STATE, AND GENDER SHOULD ALL LINE UP VERTICALLY
WITH THE SAME LEFT BORDER/MARGIN.
• YOU MUST ALSO SPACE OUT YOUR FIELDS AND ROWS SO THAT THERE IS PLENTY OF
SPACE AROUND EACH FIELD.
• THEY SHOULD NOT BE CROWDED TOGETHER.
• YOU SHOULD ALSO ADD A LABEL TO YOUR FORM IN THE FORM HEADER SECTION.
THE LABEL (USE LABEL BUTTON)FOR YOUR FORM SHOULD BE MEMBERSHIP DATA
ENTRY FORM.
• THE FONT SIZE SHOULD BE A MINIMUM OF 16 POINT FONT.
• YOUR TITLE MUST ALSO BE CENTERED.
FORMS PRACTICE (CON’T)
• YOU WILL NEED TO CHANGE THE FONT COLOR OF YOUR LABEL TEXT AND
THE FILL COLOR FOR YOUR LABEL TEXT SO THAT YOUR FORM LABEL IS EASILY
VIEWABLE ON YOUR COMPUTER SCREEN, GIVEN THE STYLE COLOR/PATTERN
THAT YOU SELECTED FOR YOUR BACKGROUND.
• SAVE AS MEMBERSHIP DATA ENTRY FORM.
REPORTS
• REPORTS ARE USED TO “DRESS UP” OR SUMMARIZE
YOUR DATA.
• REPORTS CAN BE MADE FROM A TABLE OR QUERY.
• YOU CAN USE A WIZARD TO CREATE YOUR REPORTS
OR YOU CAN CUSTOMIZE THEM TO FIT YOUR NEEDS.
• YOU CAN SPECIFY SORTING ORDERS AND YOU CAN
ALSO GROUP DATA.
CREATING A REPORT
• KIM RETURNS FROM HER STAFF MEETING WITH ANOTHER
REQUEST.
• SHE WANTS TO HAVE A LIST OF ORDERNUM,
CUSTOMERNUM, PAID AND INVOICEAMT. FROM THE ORDER
TABLE. SHE’D LIKE THE INFORMATION PRESENTED IN A MORE
READABLE FORMAT FOR SENIOR MANAGERS.
• CREATE USING “REPORT WIZARD”
• LAYOUT: TABULAR AND OTHERS
• GROUP BY: CUSTOMERNUM
• SORT THE INVOICEAMT IN DESCENDING ORDER
• SAVE THE REPORT AS ORDER LIST
MODIFYING A REPORT
• INSERT CSUB LOGO UPPER-RIGHT CORNER OF THE
REPORT
• THE TITLE IS ORDER LIST REPORT. TITLE REQUIREMENTS;
• THE TITLE MUST BE CENTERED. CHANGE BACKGROUND AND
FONT COLOR. CHANGE FONT SIZE TO 24.
• PUT A SPACE BETWEEN WORDS FOR FOLLOWINGS:
• ORDERNUM
• CUSTOMERNUM
• INVOICEAMT
MODIFYING A REPORT (CON’T)
• CHANGE ORDER NUM TO ORDER NO
• CHANGE CUSTOMER NUM TO CUSTOMER NO
• CHANGE INVOICEAMT TO INVOICE AMOUNT
• WIDEN OUT THE HEADING NAMES AND FIELD ENTRIES
SO THAT NOTHING IS CUT OFF. SPACE OUT YOUR
DATA FIELDS AS WELL. ALSO, ADJUST VERTICAL
ALIGNMENT OF EACH FIELD. ALL WORDS IN THE
REPORT MUST BE CLEARLY VISIBLE.
REPORT PRACTICE
The subform
navigation bar.
• BARBARA WANTS YOU TO CREATE A FORM SO THAT SHE CAN VIEW THE DATA
FOR EACH CUSTOMER AND ALL THE ORDERS FOR THE CUSTOMER AT THE SAME
TIME. THE FORM MUST HAVE FOLLOWING INFORMATION: CUSTOMERNUM,
CUSTOMERNAME, OWNERNAME, ORDERNUM, PAID, INVOICEAMT, AND
BILLINGDATE.
• USE THE FORM WIZARD.
• SUBFORM LAYOUT: DATASHEET & STYLE: INTERNATIONAL
• SAVE AS CUSTOMER (MAIN FORM) AND ORDER (SUBFORM)
CREATING AN ADVANCED REPORT
• KIM WOULD LIKE TO HAVE A MORE FRIENDLY AND EASY
TO READ REPORT FOR SENIOR MANAGERS. SHE NEEDS
FOLLOWING FIELDS FROM BOTH CUSTOMER AND
ORDER TABLES:
• CUSTOMERNUM, CUSTOMERNAME, PHONE, FIRST CONTACT,
ORDERNUM AND INVOICEAMT
• VIEW BY: CUSTOMER TABLE, GROUP BY: CUSTOMERNUM, AND
SORT BY: ORDERNUM FIELD IN ASCENDING ORDER, AND
LAYOUT: STEPPED
• MODIFY YOUR REPORT…..SO, LOOK NICE!!
• BARBARA FEELS THAT OTHER EMPLOYEES IN THE COMPANY WOULD BENEFIT FROM
GAINING ACCESS TO THE RESTAURANT DATABASE. LEONARD ASKS WHETHER THE
DATABASE CAN BE MADE AVAILABLE TO EMPLOYEES OVER THE COMPANY NETWORK
(I.E., INTRANET). THAT WAY, EMPLOYEES COULD OBTAIN COMPANY INFORMATION
USING THEIR DESKTOP COMPUTERS RATHER THAN USING PAPER FORMS. MOST
EMPLOYEES, SUCH AS THE CUSTOMER REPRESENTATIVES IN THE MARKETING
DEPARTMENT, DO NOT NEED TO ACCESS TO THE ENTIRE DATABASE, NOR SHOULD
THEY BE ABLE TO MAKE CHANGES TO THE DATABASE OBJECTS.
CREATING A STATIC WEB PAGE
• SIMPLE TO PUBLISH
• ONLY REFLECT THE STATE OF THE CUSTOMER TABLE AT THE TIME IT WAS CREATED.
• DOES NOT ALLOW CONTINUOUS UPDATE BECAUSE IT’S NOT LINKED TO THE CUSTOMER TABLE
ON WHICH IT IS BASED.
CREATING A DYNAMIC WEB PAGE (DATA
ACCESS PAGE)
• BARBARA ASKS IF IT’S POSSIBLE TO CREATE A DYNAMIC WEB PAGE USING THE CUSTOMER
TABLE THAT HER STAFF MEMBERS CAN UPDATE USING THEIR BROWSERS.
• USE THE PAGES OBJECTS
• SAVE AS CUSTOMER
• A DATA ACCESS PAGE IS A DYNAMIC HTML DOCUMENT.
CREATING A DYNAMIC WEB PAGE (DATA
ACCESS PAGE)
• WHEN YOU OPEN A DATA ACCESS PAGE, YOU ARE VIEWING CURRENT DATA FROM THE DATA
ACCESS PAGE, THEN YOU CAN USE THE DATA ACCESS PAGE TO VIEW OR UPDATE THE DATA IN THE
DATABASE USING A WEB BROWSER (AT LEAST MS EXPLORER VERSION 5).
• A DATA ACCESS PAGE CAN BE STORED OUTSIDE THE DATABASE AS SEPARATE HTML DOCUMENTS.
• IF A SINGLE TABLE OR QUERY IS THE BASIS OF THE DATA ACCESS PAGE, THEN YOU CAN USE THE
DATA ACCESS PAGE TO UPDATE THE DATA IN THE DATABASE.
• HOWEVER, IF TWO OR MORE RELATED TABLES ARE THE BASIS FOR THE DATA ACCESS PAGE, THEN
YOU CAN ONLY VIEW THE DATA (NO UPDATE).
IMPORTING AN HTML DOCUMENT AS AN
ACCESS TABLE
• DOWNLOAD AND THEN OPEN NEWREST HTML DOCUMENT.
• CLOSE NEWREST HTML DOCUMENT.
• IMPORT NEWREST HTML DOCUMENT INTO RESTAURANT DATABASE.
• LET THE ACCESS CHOOSE THE PRIMARY KEY.