26
BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Embed Size (px)

Citation preview

Page 1: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

BUS 110A

-Overview of the Class

-Discussion of the Syllabus

-Overview of Access

Page 2: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Why database for 110A

• Because business are generating a lot of data

• Data is useful for the companies

• Most applications require this data to generate meaningful information or perform useful activities.

• So it is important to have working knowledge of databases.

Page 3: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Overview of Access

What is a database and how is it different from database management system?– A collection of related tables.– MySJSU is a database which has tables all

related to you. Your profile, your classes and schedule, and your grades.

– Database Management System (DBMS) provides the means to store, maintain and gain access to the data.

Page 4: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Components of a Database

• Bits: 1 and 0• Bytes: 8 bits (11001100)• Field: Several Characters (e.g. Name)• Record: Several Fields (e.g. your school record)• Record key: Unique key (e.g. SSN)• Table: Group of records e.g. (my class record). • Database: Group of related tables

Page 5: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

An example of data stored in a database table

Records

Fields

Source http://www.ibm.com/developerworks/library/x-matters8/relat.gif

Relations

Page 6: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Different DBMS available in market?

• Oracle, DB2, Microsoft Access, Microsoft SQL Server, Firebird, PostgreSQL, MySQL, SQLite, FileMaker and Sybase Adaptive Server Enterprise (From Wikipedia – Click on link to read more)

• For this class we focus on MS Access and Microsoft SQL Server

Page 7: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Microsoft Access

• File operations. Open a database, close a database, tables, reports, queries.

• Remember, you have to first create a database to add files, relationships, queries, or reports

• Here are some database templates http://office.microsoft.com/en-us/templates/CT101426031033.aspx

Page 8: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Components of MS-Access window

Try each of these at home

Page 9: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Navigating databases

• For a sample file download • http://www.microsoft.com/downloads/details.aspx?

familyid=C6661372-8DBE-422B-8676-C632D66C529C&displaylang=en

• Convert the file to 2000 format by following the instructions on the screen

• Notice the tables, queries, forms, and reports. Explore them further. Notice the different views and different ways you can navigate through the tables.

Page 10: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Steps in creating database

• Plan: Purpose of the database, its scope. Remember adding a bathroom after the house is build costs 10 times as much.

• Design: Build conceptual data models, report formats, data dictionary.

• Develop: Create tables, queries, reports• Implement: Populate the database and test• Review: Periodic checks to ensure compliance.

Page 11: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Creating your own databases

• Say you are hired by a company to automate their employee payroll system.

• What are some of the fields that you can think of?

• EmployeeID, Hire Date, first name, last name, address (why do we need to break this into multiple fields?), phone number, birth date, picture, pay scale, designation, pay, hours worked, qualification.

• You can get this information by analyzing the existing records of the company.

Page 12: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Creating your own database

• You may need several tables to create this database. Why?

• Creating several tables ensures easier access, faster processing, and removes redundancy

• You can join these tables logically to create one large table by using key field

• Main table will include core information about employee that does not change on day to day basis. Example?

Page 13: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Steps to create a new database

• Step 1: Create the database file.

• Step 2: Create tables.

• Step 3: Define the relationships between the tables.

• Step 4: Create input forms (maybe).

• Step 5: Populate the database.

• Step 6: Create Reports.

• Step 7: Query the database.

Page 14: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Creating your own database

• New database blank database select location where file needs to be saved.

• Name the database as employee.• Create a new table using design view.

Explore other views for enhanced learning.• Notice different types of data types and

associated properties. • The first field is employeeID. Right click to

make it primary key.

Page 15: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Creating tables

• Add the remaining fields– Hire date : Date/time– Last/FirstName: Text– Street/City/State/Zip: Text (e.g. State 2chars)– Phone: Text– Birth Date: Text– Photo: OLE Object

• Save the table as EmpMain

Page 16: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Populating Tables

• Double click to enter the data• You don’t need to save as access automatically

updates the table. You can delete, modify, add records now.

• You can delete, modify, and add fields too.• However before you do this, you have to take

into account the data integrity issues.• You can play around with format, custom

properties, and other options to enhance the experience.

Page 17: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Adding another table and defining relationships

• Add another table called payRate which contains PayID, EmployeeID (foreign field), payrate, and payHours.

• Now define the relationship between the two tables. – Relationship can be one to one (e.g. marriage), one to

many (e.g. lectures), and many to many (e.g. debates).

• To define relationship: Tools Relationship.

Page 18: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Relationship

• This relationship will be one to many because employees get paid several times.

• You can enforce referential integrity. RI ensures consistency of data. For example, you can not delete a record in the Employee table if it has related records in the pay rate table.

• Because of the relationship, you can view the two tables logically as one big table or you can view parts of the table.

Page 19: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Forms

• A form is a database tool used to display, navigate, enter, delete, and edit records.

• The best way to design a form is to use a form wizard.

• Since the relationship is defined, you can add multiple tables to the forms.

• Select the fields that you want to be included in the form.

• This also forms the basis of visual basic. The concept of forms remain the same.

Page 20: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Querying a database.

• A query is a question that you ask to the database.

• Ex: Give me the names of all employess who got bonus > $5,000.00 in 2007

• Or give me the name of students with an average GPA of 3.9

• Queries results in a logical table which can be used with other tables and queries.

Page 21: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Queries

• Create a new query, starting with the query wizard.

• Now in the design view you can specify conditions by defining criteria expression.

• You can specify formulas and new fields.• The AND/OR operators can be used to

further develop the expressions. • A new query can be developed using

design view too.

Page 22: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Query Formulas

• For some very good examples of formulas and expressions visit

http://office.microsoft.com/en-us/access/HA100962951033.aspx?pid=CH100645701033

Page 23: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Querying two tables

• Join is an association between two tables. Joining tables brings information together from different tables. This capability to join tables is what makes relational databases so powerful and popular.

• To be joined, the tables must have at least one common field. Common fields are of same data type and contain same type of information. Usually the primary key of one table is introduced as a foreign key in the other table.

• Rest of the querying process is the same.

Page 24: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Reports

• Report writing is very similar to developing a query or a form. Again working with multiple tables is similar with reports as it is with forms and queries.

• The design mode of report allows you to rearrange the components of the report to improve its look and feel.

Page 25: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Access Database Limitations

• 2 gigabytes in size

• Maximum of 32,768 objects

• 64 character maximum in an object name

• 14 character maximum for passwords

• Support up to 255 concurrent users

Page 26: BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access

Access Table Limitations

• have up to 64 characters in each field name

• have up to 255 fields

• be one of 2048 concurrent open tables

• be up to 1 gigabyte

• have 32 indexes

• be sorted by up to 255 characters in one or more fields