Presentation on theme: "BUS 110A -Overview of the Class -Discussion of the Syllabus -Overview of Access."— Presentation transcript:
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.
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.
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
An example of data stored in a database table Records Fields Source http://www.ibm.com/developerworks/library/x-matters8/relat.gif Relations
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)OracleDB2Microsoft AccessMicrosoft SQL ServerFirebirdPostgreSQL MySQLSQLiteFileMakerSybase Adaptive Server Enterprise For this class we focus on MS Access and Microsoft SQL Server
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 http://office.microsoft.com/en- us/templates/CT101426031033.aspx
Components of MS-Access window Try each of these at home
Navigating databases For a sample file download http://www.microsoft.com/downloads/details.aspx?f amilyid=C6661372-8DBE-422B-8676- C632D66C529C&displaylang=enhttp://www.microsoft.com/downloads/details.aspx?f amilyid=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.
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.
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.
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?
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.
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.
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
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.
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.
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.
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.
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.
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.
Query Formulas For some very good examples of formulas and expressions visit http://office.microsoft.com/en- us/access/HA100962951033.aspx?pid=CH100645701033
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.
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.
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
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