Download presentation

Presentation is loading. Please wait.

Published byKianna Hilman Modified over 2 years ago

1
1 Session 3 Welcome: To session 3 - the 7 th. learning sequence “Relational algebra “ Recap : In the previous learning sequences, we discussed some operators of relational algebra. Present learning: We shall explore the following topic: Example Queries - Example Queries

2
2 Relational Algebra

3
uA basic expression in the relational algebra consists of either one of the following: wA relation in the database wA constant relation

4
Relational Instances for the Purchasing System The Supplier relation: S-numberS-nameS-city S100AhmedAmman S200AliJarash S300KasimIrbid S400JasimAquaba S500RanaAmman

5
5 The Part relation: P-numberP-nameColorPriceP-city P1TVSilver300Amman P2CameraBlack100Jarash P3VideoBlack200Amman P4PCSilver400Irbid P5PrinterRed100Irbid P6Scannersilver150Jarash

6
6 The shipment relation: S-numberP-numberQuantity S100P1100 S100P2150 S100P3200 S100P4160 S100P550 S100P670 S200P1200 S200P2150 S300P2400 S400P2150 S400P480 S500P4100

7
Example Queries uQ1- Find The cities for all suppliers. S-city (Supplier)

8
Example Queries uQ1- Find The cities for all suppliers. S-city Amman Jarash Irbid Aquaba The result relation S-city (Supplier)

9
Example Queries n Q2- Find city for Ahmed.

10
Example Queries n Q2- Find city for Ahmed. Temp1 S-name = ‘Ahmed’ (Supplier)

11
Example Queries n Q2- Find city for Ahmed. Temp1 S-name = ‘Ahmed’ (Supplier) S-numberS-nameS-city S100AhmedAmman Temp1

12
Example Queries n Q2- Find city for Ahmed. Temp1 S-name = ‘Ahmed’ (Supplier) S-numberS-nameS-city S100AhmedAmman Temp1 S-city Amman Result Result S-city (Temp1)

13
Example Queries uQ3- Find Supplier number and name for suppliers in Amman.

14
Example Queries uQ3- Find Supplier number and name for suppliers in Amman. Temp1 S-city= ‘Amman’ (Supplier)

15
Example Queries uQ3- Find Supplier number and name for suppliers in Amman. Temp1 S-city= ‘Amman’ (Supplier) S-numberS-nameS-city S100AhmedAmman S500RanaAmman Temp1

16
Example Queries uQ3- Find Supplier number and name for suppliers in Amman. Temp1 S-city= ‘Amman’ (Supplier) S-numberS-nameS-city S100AhmedAmman S500RanaAmman Temp1 Result S-number, S-name (Temp1)

17
Example Queries uQ3- Find Supplier number and name for suppliers in Amman. Temp1 S-city= ‘Amman’ (Supplier) S-numberS-nameS-city S100AhmedAmman S500RanaAmman Temp1 Result S-number, S-name (Temp1) S-numberS-name S100Ahmed S500Rana Result

18
Example Queries n Q4- For each part supplied, find the part names and the names of all cities storing these parts.

19
Example Queries n Q4- For each part supplied, find the part names and the names of all cities storing these parts. Temp1 P-number ( Shipment )

20
Example Queries n Q4- For each part supplied, find the part names and the names of all cities storing these parts. Temp1 P-number ( Shipment ) P-number P1 P2 P3 P4 P5 P6 Temp1

21
Example Queries n Q4- For each part supplied, find the part names and the names of all cities storing these parts. Temp1 P-number ( Shipment ) Temp2 Part Temp1

22
Example Queries n Q4- For each part supplied, find the part names and the names of all cities storing these parts. Temp1 P-number ( Shipment ) Temp2 Part Temp1 P-numberP-nameColorPriceP-city P1TVSilver300Amman P2CameraBlack100Jarash P3VideoBlack200Amman P4PCSilver400Irbid P5PrinterRed100Irbid P6Scannersilver150Jarash Temp2

23
Example Queries n Q4- For each part supplied, find the part names and the names of all cities storing these parts. Temp1 P-number ( Shipment ) Temp2 Part Temp1 Result P-name, p-city(Temp2) P-nameP-city TVAmman CameraJarash VideoAmman PCIrbid PrinterIrbid ScannerJarash Result

24
Example Queries n Q5- For each part supplied, find the part numbers and names of all cities supplying the parts.

25
Example Queries n Q5- For each part supplied, find the part numbers and names of all cities supplying the parts. Temp1 Shipment Supplier

26
Example Queries n Q5- For each part supplied, find the part numbers and names of all cities supplying the parts. Temp1 Shipment Supplier S-numberP-numberQuantityS-nameS-city S100P1100AhmedAmman S100P2150AhmedAmman S100P3200AhmedAmman S100P4160AhmedAmman S100P550AhmedAmman S100P670AhmedAmman S200P1200AliJarash S200P2150AliJarash S300P2400KasimIrbid S400P2150JasimAquaba S400P480JasimAquaba S500P4100RanaAmman Temp1

27
Example Queries n Q5- For each part supplied, find the part numbers and names of all cities supplying the parts. Result P-number, S-city ( Temp1 ) Temp1 Shipment Supplier P-numberS-city P1Amman P2Amman P3Amman P4Amman P5Amman P6Amman P1Jarash P2Jarash P2Irbid P2Aquaba P4Aquaba P4Amman Result

28
Example Queries n Q6- Get supplier numbers for suppliers who supply part p2

29
Example Queries n Q6- Get supplier numbers for suppliers who supply part p2 Temp1 p-number = ‘p2’ (Shipment)

30
Example Queries n Q6- Get supplier numbers for suppliers who supply part p2 Temp1 p-number = ‘p2’ (Shipment) S-numberP-numberQuantity S100P2150 S200P2150 S300P2400 S400P2150 Temp1

31
Example Queries n Q6- Get supplier numbers for suppliers who supply part p2 Temp1 P-number = ‘p2’ (Shipment) Result S-number ( Temp1 ) S-number S100 S200 S300 S400 Result

32
32 Relational Algebra Summary: In this learning sequence, we discussed some example queries about purchasing system.

33
33 END

Similar presentations

OK

A geometric sequence is a list of terms separated by a constant ratio, the number multiplied by each consecutive term in a geometric sequence. A geometric.

A geometric sequence is a list of terms separated by a constant ratio, the number multiplied by each consecutive term in a geometric sequence. A geometric.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on video teleconferencing equipment Ppt on indian army weapons systems Free ppt on french revolution Ppt on social etiquettes Ppt on switching devices on clash Ppt on layer 3 switching vs layer Ppt on area of parallelogram and triangles for class 9 Ppt on memory of computer Ppt on change management process Mit lecture ppt on probability concepts