From the following two tables, write the output of the Cartesian product. Also write primary key of customer and product table. Customer Cust. No. 111 222 333 444
Advertisements
Advertisements
Question
From the following two tables, write the output of the Cartesian product. Also write primary key of customer and product table.
Customer
| Cust. No. | Name | Address | Phone No. |
|---|---|---|---|
| 111 | Rohan Aggarwal | Delhi | 28756389 |
| 222 | Kanika Jain | Delhi | 29807654 |
| 333 | Keshav Gupta | Mumbai | 25678945 |
| 444 | Dharna | Bambay | 24675678 |
Product
| P. No. | P. Name | Price | Qty |
|---|---|---|---|
| 101 | Computer | 35000 | 3 |
| 103 | Scanner | 20000 | 2 |
| 105 | Printer | 15000 | 1 |
Very Long Answer
Advertisements
Solution
Primary keys:
- Customer table:
Cust. No. - Product table:
P. No.
The Customer table has 4 rows and the Product table has 3 rows. Therefore, the Cartesian product has 12 rows and 8 columns.
| Cust. No. | Name | Address | Phone No. | P. No. | P. Name | Price | Qty |
|---|---|---|---|---|---|---|---|
| 111 | Rohan Aggarwal | Delhi | 28756389 | 101 | Computer | 35000 | 3 |
| 111 | Rohan Aggarwal | Delhi | 28756389 | 103 | Scanner | 20000 | 2 |
| 111 | Rohan Aggarwal | Delhi | 28756389 | 105 | Printer | 15000 | 1 |
| 222 | Kanika Jain | Delhi | 29807654 | 101 | Computer | 35000 | 3 |
| 222 | Kanika Jain | Delhi | 29807654 | 103 | Scanner | 20000 | 2 |
| 222 | Kanika Jain | Delhi | 29807654 | 105 | Printer | 15000 | 1 |
| 333 | Keshav Gupta | Mumbai | 25678945 | 101 | Computer | 35000 | 3 |
| 333 | Keshav Gupta | Mumbai | 25678945 | 103 | Scanner | 20000 | 2 |
| 333 | Keshav Gupta | Mumbai | 25678945 | 105 | Printer | 15000 | 1 |
| 444 | Dharna | Bambay | 24675678 | 101 | Computer | 35000 | 3 |
| 444 | Dharna | Bambay | 24675678 | 103 | Scanner | 20000 | 2 |
| 444 | Dharna | Bambay | 24675678 | 105 | Printer | 15000 | 1 |
shaalaa.com
Is there an error in this question or solution?
