Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Chapter 2 The Relational Model 1: Introduction, QBE, and Relational Algebra.

Similar presentations


Presentation on theme: "1 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Chapter 2 The Relational Model 1: Introduction, QBE, and Relational Algebra."— Presentation transcript:

1 1 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Chapter 2 The Relational Model 1: Introduction, QBE, and Relational Algebra

2 2 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Objectives u Describe the relational model u Understand Query-by-Example (QBE) u Use Criteria in QBE u Create Calculated Columns in QBE u Calculate Statistics in QBE

3 3 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Objectives (con’t.) u Sort data in QBE u Join Tables in QBE u Update data using QBE u Understand relational algebra

4 4 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Relational Databases u Collection of tables l Each entity in own table l Attributes are fields (columns) in table l Relationships are common columns in two or more tables u Order of rows and columns is immaterial u Repeating groups are not permitted u Entries with repeating groups are unnormalized

5 5 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Relations u Two dimensional table in which: l Entries are single-valued l Each column (field or attribute) has a distinct name l All values in a column represent the same attribute l Order of columns is immaterial l Each row (record or tuple) is distinct l Order of rows is immaterial

6 6 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Query-by-Example (QBE) u Query l Questions represented in a way the DBMS can recognize and process u QBE l Visual approach to writing queries l Used in MS-Access

7 7 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Simple Queries Figure 2.3

8 8 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Simple Queries (con’t.) Figure 2.4

9 9 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Query that Includes All Fields Figures 2.5 – 2.6

10 10 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Query with Simple Criteria Figures 2.7 – 2.8

11 11 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Query Using AND Criteria Figures 2.9 – 2.10

12 12 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Query Using OR Criteria Figures 2.11 – 2.12

13 13 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Query Using Two Conditions on a Single Field Figures 2.13 – 2.14

14 14 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Query Using Computed Field Figures 2.15 – 2.16

15 15 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Query to Count Records Figures 2.17 – 2.18

16 16 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Query to Calculate an Average Figures 2.19 – 2.20

17 17 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Query to Sort Records Figures 2.23 – 2.24

18 18 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Query to Sort on Multiple Keys Figure 2.27

19 19 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Query to Sort on Multiple Keys (con’t.) Figure 2.28

20 20 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Query to Join Tables Figure 2.29

21 21 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Query to Join Tables (con’t.) Figure 2.30

22 22 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Query to Restrict Records in a Join Figures 2.31 – 2.32

23 23 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Update Query Figure 2.35

24 24 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Delete Query Figure 2.36

25 25 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Make-Table Query Figure 2.37

26 26 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Make-Table Query (con’t.) Figure 2.39

27 27 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Relational Algebra u Theoretical way of manipulating a relational database to produce new tables u Major commands l SELECT u Retrieves certain rows l PROJECT u Include certain columns l JOIN u Pull data from more than one table

28 28 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Customer & Sales Rep Tables Figure 2.40

29 29 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Join of Customer and Sales Rep Figure 2.41

30 30 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Outer Join of Customer and Sales Rep Figure 2.42

31 31 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Normal Set Operations u Union of two tables l Result contains all rows that are in either the first table, the second table, or both u Intersection of two tables l Result contains all rows common to both u Difference of tables l Result is the set of rows in one table but not the other

32 32 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Normal Set Operations (con’t.) u Product of two tables l Result contains Cartesian product l Obtained by concatenating every row in first table with every row in second table u Division Process l Result contains quotient

33 33 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Product of Two Tables Figure 2.43

34 34 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Dividing One Table by Another Figure 2.44


Download ppt "1 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Chapter 2 The Relational Model 1: Introduction, QBE, and Relational Algebra."

Similar presentations


Ads by Google