Presentation is loading. Please wait.

Presentation is loading. Please wait.

DAY 15: ACCESS CHAPTER 1 Rahul Kavi October 6, 2015 1.

Similar presentations


Presentation on theme: "DAY 15: ACCESS CHAPTER 1 Rahul Kavi October 6, 2015 1."— Presentation transcript:

1 DAY 15: ACCESS CHAPTER 1 Rahul Kavi Rahul.Kavi@mail.wvu.edu October 6, 2015 1

2 LAST LECTURE Introduction to Databases. Tables. Fields. What is a primary key? 2

3 TODAY Creating databases. Saving databases. Creating tables. Design tables. Modify tables. Set Primary key. Set a relationship. Import xml data. 3

4 ACCESS INTERFACE Ribbon interface. Create (tables, forms, queries, reports) External data(import data, export data) Database tools (relationships, compact- repair database). 4

5 TABLES Similar to a Excel Worksheet. But can have “relationships” with other tables. If we enforce relationships between tables, Access will enforce rules in data entering, editing, retrieval and removal. This makes it easier to manage and retrieve data (by enforcing relationships between tables). 5

6 TABLES: PRIMARY KEY The primary key uniquely identifies each record in a table. By default, tables have an ID field that is an auto-incremented integer –Whenever a new record is entered, its count goes up by 1 (you can change this behavior) 6

7 EXAMPLE OF PRIMARY KEY How to come up with a primary key? How do you uniquely identify something in a given data table? Name? (multiple people with same name) SSN? Student ID? Email ID? How do you uniquely identify a student based on given data (on paper)? WVU ID, Phone Number? 7

8 IDENTIFY PRIMARY KEYS Address Table PhoneNumber Table 8

9 EXCEL VS ACCESS (TABLES) What do we use (Excel or Access) in this scenario (to store data)? If customer loses credit card, delete old credit card info, enter new credit card information. But this information cannot be empty. The above scenario is hard to do in Excel, but easy in Access. Cells can be left empty in Excel. Records in Access can be forced to entered with some value (and not left empty). 9

10 RELATIONSHIP BETWEEN TABLES Address Table PhoneNumber Table 10

11 REFERENTIAL INTEGRITY (IDENTIFY COMMON FIELDS) Address Table PhoneNumber Table Use common field to create a relationship 11

12 RELATIONSHIPS: REFERENTIAL INTEGRITY Wikipedia: “Referential integrity is a property of data which, when satisfied, requires every value of one attribute (column) of a relation (table) to exist as a value of another attribute in a different (or the same) relation (table)”. 12

13 WHAT HAPPENS IF WE ENFORCE REFERENTIAL INTEGRITY? With referential integrity, we can relate fields in one table with fields in another table. Otherwise, Access will not know they are related. 13

14 THINGS TO DO Download data files for today. Open instructions (pdf). Follow instructions 14

15 NEXT CLASS What happens if referential integrity is not enforced. What happens when referential integrity is enforced. Access Forms. Creating forms to enter data. Basic Queries. 15

16


Download ppt "DAY 15: ACCESS CHAPTER 1 Rahul Kavi October 6, 2015 1."

Similar presentations


Ads by Google