ch5-2 - Chapter 5: Other Relational Languages !...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
1 ©Silberschatz, Korth and Sudarshan 5.1 Database System Concepts Chapter 5: Other Relational Languages Chapter 5: Other Relational Languages ! Query-by-Example (QBE) ! Datalog ©Silberschatz, Korth and Sudarshan 5.2 Database System Concepts Query Query -by by -Example (QBE) Example (QBE) ! Basic Structure ! Queries on One Relation ! Queries on Several Relations ! The Condition Box ! The Result Relation ! Ordering the Display of Tuples ! Aggregate Operations ! Modification of the Database
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 ©Silberschatz, Korth and Sudarshan 5.3 Database System Concepts QBE QBE — Basic Structure Basic Structure ! A graphical query language which is based (roughly) on the domain relational calculus ! Two dimensional syntax – system creates templates of relations that are requested by users ! Queries are expressed “by example” ©Silberschatz, Korth and Sudarshan 5.4 Database System Concepts QBE Skeleton Tables for the Bank QBE Skeleton Tables for the Bank Example Example
Background image of page 2
3 ©Silberschatz, Korth and Sudarshan 5.5 Database System Concepts QBE Skeleton Tables (Cont.) QBE Skeleton Tables (Cont.) ©Silberschatz, Korth and Sudarshan 5.6 Database System Concepts Queries on One Relation Queries on One Relation ! Find all loan numbers at the Perryridge branch. • _x is a variable (optional; can be omitted in above query) • P. means print (display) • duplicates are removed by default • To retain duplicates use P.ALL
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 ©Silberschatz, Korth and Sudarshan 5.7 Database System Concepts Queries on One Relation (Cont.) Queries on One Relation (Cont.) ! Display full details of all loans P._x P._y P._z " Method 1: " Method 2: Shorthand notation ©Silberschatz, Korth and Sudarshan 5.8 Database System Concepts Queries on One Relation (Cont.) Queries on One Relation (Cont.) ! Find names of all branches that are not located in Brooklyn ! Find the loan number of all loans with a loan amount of more than $700
Background image of page 4
5 ©Silberschatz, Korth and Sudarshan 5.9 Database System Concepts Queries on One Relation (Cont.) Queries on One Relation (Cont.) ! Find the loan numbers of all loans made jointly to Smith and Jones. ! Find all customers who live in the same city as Jones ©Silberschatz, Korth and Sudarshan 5.10 Database System Concepts Queries on Several Relations Queries on Several Relations ! Find the names of all customers who have a loan from the Perryridge branch.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
©Silberschatz, Korth and Sudarshan 5.11 Database System Concepts Queries on Several Relations (Cont.) Queries on Several Relations (Cont.) ! Find the names of all customers who have both an account and a loan at the bank. ©Silberschatz, Korth and Sudarshan 5.12 Database System Concepts Negation in QBE Negation in QBE ! Find the names of all customers who have an account at the bank, but do not have a loan from the bank. ¬ means “there does not exist”
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 36

ch5-2 - Chapter 5: Other Relational Languages !...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online