Presentation is loading. Please wait.

Presentation is loading. Please wait.

8 1 Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.

Similar presentations


Presentation on theme: "8 1 Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel."— Presentation transcript:

1 8 1 Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel

2 8 2 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel In this chapter, you will learn: About the relational set operators UNION, UNION ALL, INTERSECT, and MINUS How to use the advanced SQL JOIN operator syntax About the different types of subqueries and correlated queries How to use SQL functions to manipulate dates, strings, and other data

3 8 3 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel In this chapter, you will learn (continued): How to create and use updatable views How to create and use triggers and stored procedures How to create embedded SQL

4 8 4 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Relational Set Operators UNION INTERSECT MINUS Work properly if relations are union- compatible –Names of relation attributes must be the same and their data types must be identical

5 8 5 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel UNION Example query: –SELECT CUS_LNAME, CUS_FNAME, CUS_INITIAL, CUS_AREACODE, CUS_PHONE FROM CUSTOMER UNION SELECT CUS_LNAME, CUS_FNAME, CUS_INITIAL, CUS_AREACODE, CUS_PHONE FROM CUSTOMER_2;

6 8 6 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel UNION (continued)

7 8 7 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel UNION ALL Example query: –SELECT CUS_LNAME, CUS_FNAME, CUS_INITIAL, CUS_AREACODE, CUS_PHONE FROM CUSTOMER UNION ALL SELECT CUS_LNAME, CUS_FNAME, CUS_INITIAL, CUS_AREACODE, CUS_PHONE FROM CUSTOMER_2;

8 8 8 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel UNION ALL (continued)

9 8 9 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel INTERSECT

10 8 10 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel MINUS

11 8 11 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Syntax Alternatives

12 8 12 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Syntax Alternatives (continued)

13 8 13 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel SQL Join Operators

14 8 14 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Cross Join Syntax: –SELECT column-list FROM table1 CROSS JOIN table2

15 8 15 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Natural Join

16 8 16 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel JOIN USING Clause

17 8 17 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel JOIN ON Clause

18 8 18 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Outer Joins Returns not only matching rows, but also rows with unmatched attribute values for one table or both tables to be joined Three types –Left –Right –Full

19 8 19 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Outer Joins (continued)

20 8 20 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Outer Joins (continued)

21 8 21 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Outer Joins (continued)

22 8 22 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Subqueries and Correlated Queries

23 8 23 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel WHERE Subqueries

24 8 24 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel IN Subqueries

25 8 25 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel HAVING Subqueries

26 8 26 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Multirow Subquery Operators: ANY and ALL

27 8 27 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel FROM Subqueries

28 8 28 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Attribute List Subqueries

29 8 29 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Attribute List Subqueries (continued)

30 8 30 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Correlated Subqueries

31 8 31 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Correlated Subqueries (continued)

32 8 32 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Date and Time Functions

33 8 33 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Date and Time Functions (continued)

34 8 34 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Date and Time Functions (continued)


Download ppt "8 1 Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel."

Similar presentations


Ads by Google