The relational model 2

23
THE RELATIONAL MODEL 2: SQL JOINING TABLES

description

 

Transcript of The relational model 2

Page 1: The relational model 2

THE RELATIONAL MODEL 2: SQL

JOINING TABLES

Page 2: The relational model 2

Accomplished by:

-entering the appropriate conditions in the WHERE

clause.

Page 3: The relational model 2

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
Page 5: The relational model 2
Page 6: The relational model 2

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
Page 8: The relational model 2
Page 9: The relational model 2

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
Page 11: The relational model 2
Page 12: The relational model 2

A table containing all rows that are in the first table, second table, or

both tables.

Page 13: The relational model 2

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
Page 15: The relational model 2
Page 16: The relational model 2
Page 17: The relational model 2

Change the street address of

customer 524 to 1445 Rivard

example

Page 18: The relational model 2
Page 19: The relational model 2

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
Page 21: The relational model 2

Delete any row in the OrderLine table

in which the part number is BV06.

example

Page 22: The relational model 2
Page 23: The relational model 2

By the way, thank you for listening to Angela Torres =D

God Bless !!