Presentation is loading. Please wait.

Presentation is loading. Please wait.

CHAPTER 1 – INTRODUCTION TO ACCESS Aliya Farheen March 5, 2014.

Similar presentations


Presentation on theme: "CHAPTER 1 – INTRODUCTION TO ACCESS Aliya Farheen March 5, 2014."— Presentation transcript:

1 CHAPTER 1 – INTRODUCTION TO ACCESS Aliya Farheen aliya.farheen@mail.wvu.edu March 5, 2014

2 ANNOUNCEMENTS MyITLab Lesson C is due March 16, Monday 2015. Plan yourself to complete all chapters.

3 INTRODUCTION A database consists of one or more tables to store data, one or more forms to enter data into the tables, and one or more reports to output the table data as organized information. The Navigation Pane organizes and lists the database objects in Access database. The Datasheet view is where you add, edit, and delete the records of a table. The Design view is where you create tables, add and delete fields, and modify field properties.

4 INTRODUCTION A Primary Key is the field that uniquely identifies each record in a table. A Form is an object that enables you to enter, modify, or delete table data. A Query is a question that you ask about the data in the tables of your database. A Criterion is a number, a text phase, or an expression used to filter the records in a table. A Report contains professional looking formatted information from tables or queries.

5 OPENING A TABLE Download the file Bookstore.accdb In the Tables areas of the Objects Bar, Double-click Books Notice a table with 22 records showing in Datasheet view

6 LOOKING IN DATASHEET VIEW Datasheet view shows a table’s contents in rows and columns like a spreadsheet would Each Field Name is inside a clickable “Field Selector” that will highlight that column Each row has a clickable “Record Selector” to its left…

7 TABLE IN DATASHEET VIEW Field Names & Selectors RecordsRecords Navigatio n

8 NAVIGATING A DATASHEET The current record is shown with an amber highlight Navigation buttons at the bottom of the table window allow for moving around the table easily…

9 NAVIGATION BAR

10 ADDING RECORDS Click the “New Record” button at the bottom Enter 5-555555-55-5 for the ISBN Number Enter “Access is Your Friend” for a title Enter your last name as an Author… Put 2010 for the year Make the book 95.00 Make the publisher: Que Publishing

11 EDITING A RECORD Let’s say that a price changed on the “Presentation Design Book” Change the price from $31.95 to $42.95

12 DELETING A RECORD Delete Cobol book from Prentice Hall. Right click the record selector and then select Delete Record. Confirm the “Permanent” deletion. Close the table clicking its “X”…

13 MANAGING FIELDS OF BOOKS TABLE View -> Design view Click on last empty cell of FIELD NAME and give one field name and its appropriate DATA TYPE. Note: You can observe the Field properties at bottom Switch to DATA SHEET view and observe the new Field added to the records.

14 FORMS Form – Object one uses to add, maintain, & view records in a database Gives a different view to do this in than from Datasheet View Easier to use for less knowledgeable people…

15 USING A EXISTING FORM Forms make it easy for anyone to work with information in a table in a simple interface… Under “Forms” in the object bar, Double click Books Click the last record button to see your entry !

16 ADDING/DELETING/FINDING RECORDS WITH FORMS Use the controls to return to the first record Note there being 22 records Create a new record ( ISBN ‘6-666666-66- 6, Year 2010 and give other details also) Find the record with ISBN Number ‘0-07- 070318-3’ Delete this record

17 USING AN EXISTING REPORT Report – Nicely formatted display of information suitable for printout Close the form only In Reports object bar area Double click All Books Find your two entries under the appropriate publishers

18 QUERIES The idea is to save the time of having to manually look through a myriad of records to try and find the information needed Let’s take a look at an existing query…

19 QUERIES A Query is a question one asks about the data stored in a database Access responds by displaying specific records that answer the question In creating a query, we tell access which fields are needed and what criteria needs to be met

20 AN EXISTING QUERY Close the report In the Queries area of the objects bar, Double-click Publication Year Enter 2010 and click OK You should see your two records.

21 COMPACT AND REPAIR Reduces the size of the database Perform this after you done working with access database. File->info->Compact and repair database

22 GET THE SECOND DATABASE Close the Bookstore database Download and open the file Look_ahead.accdb * Premise: We are running a company and this database tracks information on our employees

23 FILTERS Give a temporary view of desired data to help isolate portions Filter by Selection – lets us specify an example Filter by Form – more powerful, can search for records meeting multiple conditions and by operators such as:, =

24 FILTER BY SELECTION EXAMPLE Say we wish to isolate our employees with poor performance… Open the Employees table Click in one of the field values containing Poor Click Selection in the Sort & Filter group Select Equals Poor Click Toggle Filter to turn off

25 FILTER BY FORM EXAMPLE Say we want to see all Females making over $40k… Select Advanced in Sort & Filter group Choose Filter By Form Remove Poor from performance Select F for Gender Enter >40000 for Salary Click the Toggle Filter button Review the results Toggle the filter off

26 SORTING ON A SINGLE FIELD Sorting allows us to arrange the way the table data looks… Click in a record under the Last Name field Click the Sort Ascending button Next, sort ascending on Salary

27 SORTING ON MULTIPLE FIELDS Fields must be side by side to do this Click and Drag to highlight both the LastName and FirstName fields Sort Descending (Note the Smith’s first names) Do it again Ascending

28 DATABASES & RELATIONSHIPS A Database is a collection of “Related” tables –This can also be called a “Relational Database” A Common Field between tables is what allows a relationship to exist. This works by way of “Primary” and “Foreign” keys…

29 PRIMARY KEYS Primary Key – Field in a every table whose field values are unique for every record Examples might be things like: –Student ID numbers –SSN number –Cell Number –Anything that will not have duplicates as additional records are entered

30 RELATIONSHIPS Foreign Key – Similar/Same field in the second related table in the relationship –Primary key field in relationship will have similar data type and content to foreign key field –The two tables are joined together on the primary and foreign keys and form a Common Field.

31 RELATIONSHIPS The link formed through this Common Field which is dubbed in one case as a “primary key”, and in another as a “foreign key”, allows tables to share data Note that the “Look Ahead” database has 3 tables, but we will only look at 2 of them..

32 1: EMPLOYEES TABLE… EmployeeID is the Primary Key as all numbers are unique for employee records

33 2: LOCATIONS TABLE… LocationID is the primary key and each record has a unique LocationID designator. This will tie back to the Employees table.

34 RELATIONSHIPS Databases are all about efficiency and not having to store the same information more than once if multiple records need it Types of Relationship: –One to One –One to Many –Many to Many

35 RELATIONSHIPS In this example, we know that multiple people work at the same office address. One address can have many related Employees (One to Many)… Instead of typing the same address in each record for every Atlanta office employee: “450 Peachtree Road…” We can assign a simple relationship to a “Locations” table and reference this information to a given location with a short common code of “L01” between the tables…

36 ONE TO MANY RELATIONSHIP Typing “L01” when entering an employee and having it equate to the entire address saves MANY characters in databases as it is reused over and over. “L01” is 3 characters and the entire address is over 30 !

37 MAKING THE RELATIONSHIP These tables need to be tied together (related) to work this way…  Open the Relationships Window  Database Tools ribbon > Relationships  Click Show Table  Double click Employees & Locations, then Close

38 THE RELATIONSHIPS WINDOW The Relationship window depicts included table structures and their associations Within the structures, we see each table’s fields Primary keys are shown with a key icon

39 MAKING THE RELATIONSHIPS  Drag “LocationID” from the “Locations” table to “LocationID” in the “Employees” table.  Notice the “One-To-Many” reference  Click to Enforce Referential Integrity  Click Create…

40 RELATIONSHIP FORMED Note the One to Many (1 to infinity symbol) that formed on the join line…  Close and save the relationship  Run the “Employee Information” query to see data pulled together from both tables… Note, the relationship we made was already created in the query we ran and we did this only for increased understanding of how to create relationships.

41 QUERY RESULTS Information is pulled from the “Employee” and “Locations” tables through their relationship and shown united within the query results to give us a complete picture of the information ! The LocationID field was used behind the scenes to pull it all together with the L01 value The full address is actually only stored (taking up space) once in the database, and we are able it multiple times as needed.

42 REFERENTIAL INTEGRITY Enforce reference integrity : You cannot enter a foreign key value in a related table unless the primary key value exists in the primary table. And you cannot delete a primary key value if there is a foreign key referencing that primary key. Example : Here you cannot enter location information into Employees table unless the location information is first entered into the Locations table. Also you cannot delete records from Locations table if there are any related records for that location in the Employees table 42

43 REFERENTIAL INTEGRITY Cascade Update / Delete Related Records 43

44 HOW TO DELETE RELATIONSHIP BETWEEN FIELDS? Click on the line between the fields (which shows relation) and press delete key.

45


Download ppt "CHAPTER 1 – INTRODUCTION TO ACCESS Aliya Farheen March 5, 2014."

Similar presentations


Ads by Google