The relational model 2
-
Upload
angela-torres -
Category
Education
-
view
418 -
download
0
description
Transcript of The relational model 2
![Page 1: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/1.jpg)
THE RELATIONAL MODEL 2: SQL
JOINING TABLES
![Page 2: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/2.jpg)
Accomplished by:
-entering the appropriate conditions in the WHERE
clause.
![Page 3: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/3.jpg)
List the number and name of each
customer together with the number,
last name, and first name of the sales
rep who represents the customer.
Order the records by customer number.
example
![Page 4: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/4.jpg)
![Page 5: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/5.jpg)
![Page 6: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/6.jpg)
example
List the number and name of each
customer whose credit limit is $10000
together with the number, last name,
and first name of the sales rep who represents the
customer. Order the records by customer
number.
![Page 7: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/7.jpg)
![Page 8: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/8.jpg)
![Page 9: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/9.jpg)
For every order, list the order number, order date, customer number, and customer name. In addition, for each order line within the order, list the part number, description, number ordered, and quoted price. Order the records by order number.
example
![Page 10: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/10.jpg)
![Page 11: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/11.jpg)
![Page 12: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/12.jpg)
A table containing all rows that are in the first table, second table, or
both tables.
![Page 13: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/13.jpg)
List the number and name of all customers
that are represented by sales rep 35 or that
currently have orders on file or both.
example
![Page 14: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/14.jpg)
![Page 15: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/15.jpg)
![Page 16: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/16.jpg)
![Page 17: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/17.jpg)
Change the street address of
customer 524 to 1445 Rivard
example
![Page 18: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/18.jpg)
![Page 19: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/19.jpg)
Add a new sales rep to the Rep table. Her number is 16; name is Sharon Rands; address is 826 Raymond, Altonville, FL 32543.
She has not yet earned any commission, but her
commission rate is 5%.
example
![Page 20: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/20.jpg)
![Page 21: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/21.jpg)
Delete any row in the OrderLine table
in which the part number is BV06.
example
![Page 22: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/22.jpg)
![Page 23: The relational model 2](https://reader035.fdocuments.in/reader035/viewer/2022062616/549850a1b479594c4d8b53d8/html5/thumbnails/23.jpg)
By the way, thank you for listening to Angela Torres =D
God Bless !!