Presentation is loading. Please wait.

Presentation is loading. Please wait.

3. Relational Model Lingma Acheson Department of Computer and Information Science IUPUI CSCI N207 Data Analysis with Spreadsheets 1.

Similar presentations


Presentation on theme: "3. Relational Model Lingma Acheson Department of Computer and Information Science IUPUI CSCI N207 Data Analysis with Spreadsheets 1."— Presentation transcript:

1 3. Relational Model Lingma Acheson Department of Computer and Information Science IUPUI CSCI N207 Data Analysis with Spreadsheets 1

2 Relations Databases help people keep track of things. The thing that is being tracked is called an Entity. An entity is something of importance to the user that needs to be represented in the database. Databases store data in the form of Relations – “Relational Database”. 2

3 Relations A Relation is a two-dimensional table with the following characteristics: 3

4 Relations E.g. Relations: Non-relations: 4

5 Relations Non-relations: 5

6 Relations Sometimes, the term “Table” and “Relation” are used interchangeably, but strictly speaking, some tables are not relations. Conventions – –Table names are all uppercases, with words connected by underscores. E.g. EMPLOYEE_PROJECT_ASSIGNMENT –Column names starts with uppercase. If two words are used, each word starts with upper case. Words are connected with nothing in between. E.g. FirstName, PhoneNumber 6

7 Primary Key A field used as the unique identifier in the database. E.g. EmployeeNumber An ideal primary key is short, numeric and never changes. 7

8 Primary keys and Foreign Keys Sometimes values from one table appear in a second table. Two records can be linked together by the same value. 8

9 Primary keys and Foreign Keys The unique identifier should be the Primary Key. The key that holds the values repeated in the second table is a Foreign Key. 9

10 Primary keys and Foreign Keys A value of the foreign key must match with a value of the primary key. E.g. The Adviser number in the STUDENT table must first appear in the ADVISER table. The two keys must be of the same type. In Access, “AutoNumber” must be matched with “Number”. 10

11 Define a Relationship This constraint can be enforced by defining a Relationship.The constraint is called a “referential integrity constraint”. By defining a relationship, we are asking the software tool to ensure that the values and types are matched. If a value that doesn’t satisfy the constraint is entered, the entry is not allowed. See Demo video about how to define a relationship. 11


Download ppt "3. Relational Model Lingma Acheson Department of Computer and Information Science IUPUI CSCI N207 Data Analysis with Spreadsheets 1."

Similar presentations


Ads by Google