day 12: databases rahul kavi rahul.kavi@mail.wvu.edu rahul.kavi@mail.wvu.edu october 3, 2013 1

Post on 13-Dec-2015

217 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

DAY 12:DATABASES

RAHUL KAVIRahul.Kavi@mail.wvu.edu

October 3, 2013

1

2

DATABASES

• A database is an organized collection of data

• There are many types of databases– Flat File– XML– Workbooks– Relational– Key-Value Store

3

WHERE ARE DATABASES USED?

• Storing bank records, corporate data, etc.• Storing login credentials for websites/blogs.• Store content of popular websites like

Flickr.com, YouTube.com, etc.• Store content of popular services like

Netflix, Instagram, Pandora, iTunes, Spotify, Game Center (iOS), App Store, Play Store (Android App Store).

4

RELATIONAL DATABASES

• Access is a relational database– A relational database is a collection of data

items organized as a set of formally described tables.

– Data stored in tables.– In addition to table definitions, there are also

relationships between tables

5

EXCEL VS ACCESS

• Excel: Spreadsheet application to arrange, and analyze data in sheets. Sheets have no relation enforced with each other. May have duplicate data.

• Access: Database application to store, retrieve, edit, delete, add data (using relationships between data). We can enforce relation between tables you can avoid redundant data.

6

RELATION BETWEEN TABLES?

• Example: Table Name: UserTable

Contents/Fields of UserTable: (username, password)

Username: String/Character data (includes special characters)

Password: String/Character data

• Other examples:– iTunes Account ---> Apple ID <---- App Store account.– Mix Email Account --> My ID <---- WVU WiFi

• There is a user table for each of the above accounts.

7

RECORDS AND FIELDS REVIEW

• A single entry in a table is called a “record” (horizontal entries/rows)

• Each piece of data in a record is a “field” (vertical column names/column).

8

CASCADING

• Example of a Cascade Delete:

If you delete your Google account, you lose access to YouTube, Gmail, etc. Your ability to login is lost across all Google Services.• Example of a Cascade Update: If you

lose your credit card and get a new one, your information is updated (not deleted) across all of your services (provided by credit card company).

9

OPEN ACCESS

• Start->Access-> Blank desktop database.

• Enter name of the database “Day1Access_LastName_FirstName.

• Click create.

10

DESIGN TABLE• Right click on Table 1 tab.• Click design.• Enter “UserName” (no spaces between

words).• Ensure UserName is a primary key.• Field Name 1: “NameOfUser”• Data Type: “Short Text”.• Field Name2: “Password”.• Data Type: “Short Text”.

11

DATASHEET VIEW• Right click on Table 1 tab.• Click datasheet view.• Enter 5 usernames and passwords.• Try entering duplicate usernames.

top related