Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Relational Database Systems 1 Lecture 4.

Similar presentations


Presentation on theme: "Introduction to Relational Database Systems 1 Lecture 4."— Presentation transcript:

1 Introduction to Relational Database Systems 1 Lecture 4

2 Introduction to Relational Database Systems 2 Relational database systems data objects relations / tables operators applied to tables generate tables

3 Introduction to Relational Database Systems 3 Relations / tables explicit data values extensionally defined atomic keys integrity design includes how to organise data in tables

4 Introduction to Relational Database Systems 4 Data about departments Depts

5 Introduction to Relational Database Systems 5 Data about employees Emps

6 Introduction to Relational Database Systems 6 Atomic values no access to individual items

7 Introduction to Relational Database Systems 7 Primary and foreign keys primary foreign

8 Introduction to Relational Database Systems 8 Integrity restrictions on data defined by users on individual tables age > 18; salary < 100k on more than one table if budget < 10M then salary < 50k implicit in the data model

9 Introduction to Relational Database Systems 9 Primary key integrity incorrect model

10 Introduction to Relational Database Systems 10 Foreign key integrity incorrect model ?

11 Introduction to Relational Database Systems 11 Relational operators characteristics set at a time base and derived tables closed with respect to relations / tables nested expressions include RESTRICT PROJECT JOIN

12 Introduction to Relational Database Systems 12 RESTICT RESTRICT Depts WHERE Budget > 8M

13 Introduction to Relational Database Systems 13 PROJECT PROJECT Depts OVER Dept_id, Budget

14 Introduction to Relational Database Systems 14 JOIN JOIN Depts AND Emps OVER Dept_id

15 Introduction to Relational Database Systems 15 Nested statements the members of all departments that have the budget greater than 7M JOIN (RESTRICT Depts WHERE Budget > 7M) AND Emps OVER Dept_id

16 Introduction to Relational Database Systems 16 Relational model a data model in which all data is modelled as relations a way of looking at data a prescription for a way of representing data manipulating data representing integrity constraints

17 Introduction to Relational Database Systems 17 Relational database systems relational DBMS implements the relational model not in its entirety may add new features relational database system a database application developed in the relational model and implemented in a relational DBMS physical details hidden from the user

18 Introduction to Relational Database Systems 18 Relational DBMS - features views security the optimiser the data catalogue / data dictionary

19 Introduction to Relational Database Systems 19 Views (in relational systems) named derived table the definition stored in the catalogue evaluated only when used optimisation used as if it were a real table problems with updates views ANSI/SPARC relational

20 Introduction to Relational Database Systems 20 Views CREATE VIEW TopEmp AS PROJECT (SELECT Emps WHERE Salary > 33K) OVER E_name, Salary

21 Introduction to Relational Database Systems 21 Views - usage SELECT TopEmp WHERE Salary <= 40 SELECT PROJECT SELECT Emps WHERE Salary > 33 OVER E_name, Salary WHERE Salary <= 40

22 Introduction to Relational Database Systems 22

23 Introduction to Relational Database Systems 23 Security and views how would you use the view mechanism in conjunction with the security system? DEFINE SECURITY RULE AS...

24 Introduction to Relational Database Systems 24 The optimiser operators - set level the DBMS decides how to best perform the operations, based on strategies of evaluation information about the DB (in the catalogue)

25 Introduction to Relational Database Systems 25 The best evaluation strategy PROJECT SELECT Emps WHERE E_id = E2 OVER E_name, Salary

26 Introduction to Relational Database Systems 26 The catalogue information about the database schemas mappings integrity rules views definition security rules... other modules that need it the optimiser the security system...

27 Introduction to Relational Database Systems 27 The system table Tables PROJECT Tables OVER Coulcount, Rowcount

28 Introduction to Relational Database Systems 28 The system table Columns

29 Introduction to Relational Database Systems 29 Summary relational model relations operators integrity relational DBMSs implement the relational model views + security the optimiser the catalogue next lecture : SQL


Download ppt "Introduction to Relational Database Systems 1 Lecture 4."

Similar presentations


Ads by Google