Presentation is loading. Please wait.

Presentation is loading. Please wait.

Databases. Not All Tables Are Created Equal Spreadsheets use tables to store data and formulas associated with that data The “meaning” of data is implicit.

Similar presentations


Presentation on theme: "Databases. Not All Tables Are Created Equal Spreadsheets use tables to store data and formulas associated with that data The “meaning” of data is implicit."— Presentation transcript:

1 Databases

2 Not All Tables Are Created Equal Spreadsheets use tables to store data and formulas associated with that data The “meaning” of data is implicit Row and column labels are essentially for decoration, they are not actually linked to the data Spreadsheet tables lack the necessary structure to relate entries in one table to entries in another

3 Databases Structured collections of data Indexed and organized In contrast to – Files (unstructured) – Spreadsheets (structure but no semantic (meaningful) indexing)

4 Relational Databases Specialized tables that describe relationships between data items Relate the contents of one or more tables Based on – Properties that are common between tables – Items that are in common This “structure” allows us to filter and compose data efficiently

5 Logical Data Model Entities- tables of anything that can be identified by some number of characteristics, called attributes. Attributes have names and values, and these “values” are what is actually stored in a database’s table. Relationships are defined between entities (tables)

6 Database Properties Instances are unordered. There is no inherent order to the rows and columns of a table Uniqueness. Each instance (row) must be unique Keys. Some subset of attributes (columns) distinguishes each instance in the table. There may be several distinct subsets that distinguish instances; each is a candidate key. Because databases usually have several candidate keys, we choose one and call it the primary key.

7 Entity Relationship Diagram Relationships between entities (tables) can be 1-to-many (A department has many faculty) There is usually a table for each entity with a 1-to-many relationship

8 Relationships One-to-one: There is one instructor per class One-to-many: A department has many faculty members Many-to-many: Each student takes several classes, and each class has a list of students

9 A Database’s Schema The combination of table attributes and relations specify the structure of a database This structure is called the database’s schema A schema can be specified for an empty database

10 Database Operations Select - extracts rows from one table to create a new table. Select From

11 Database Operations Project - extracts columns from one table to create a new table. Select From

12 Database Operations Database operations can be composed

13 Database Operations Product for Combining tables

14 Product Result

15 Using Database Products Usually table products would be combined with a series of Select and Project operations Most often, products would combine tables that do not share common attributes

16 One More Database Operation Join: also combines two tables, but only where the specified attributes match Result = Join Nations, NationStats On Nations.Name = NationStats.Name

17 Database Operations Database operations can be composed

18 Summary Databases are specialized tables with names and attributes for all entities In a relational database, there exist relations between tables The combination of a tables attributes and relations between the tables in a datbase comprise it’s schema Databases provide basic operations including- Select, Project, Product, Join


Download ppt "Databases. Not All Tables Are Created Equal Spreadsheets use tables to store data and formulas associated with that data The “meaning” of data is implicit."

Similar presentations


Ads by Google