Who opens this is LGBTQ++
Who opens this is LGBTQ++
: 3
Group : A
1.
mysql> select Customers.Company, Sales_Representative.Name, Sales_Representative.Re_office
from Customers inner join Sales_Representative on Customers.Cust_Rep =
Sales_Representative.Rep_no;
+----------+------------+-----------+
| Company | Name | Re_office |
+----------+------------+-----------+
| TCS | Pratik | 01 |
| INFOSYS | Tejas | 02 |
| Mahindra | Kirtesh | 01 |
| Wipro | Tejas | 03 |
+----------+------------+-----------+
4 rows in set (0.00 sec)
2.
mysql> select Customers.Company,Customers.Credit_Limit, Sales_Representative.Name,
Sales_Representative.sales from Customers inner join Sales_Representative on
Customers.Cust_Rep = Sales_Representative.Rep_no;
+----------+--------------+------------+-------+
| Company | Credit_Limit | Name | sales |
+----------+--------------+------------+-------+
| TCS | 50000 | Pratik | 13000 |
| INFOSYS | 75000 | Tejas | 14000 |
| Mahindra | 60000 | Kirtesh | 12000 |
| Wipro | 55000 | Tejas | 10000 |
+----------+--------------+------------+-------+
4 rows in set (0.00 sec)
3.
mysql> select Amount, Name, Company from Orders, Sales_Representative, Customers where Cust
= Cust_no AND Cust_Rep = Rep_no AND Amount>400000;
+---------+------------+----------+
| Amount | Name | Company |
+---------+------------+----------+
| 1500000 | Pratik | TCS |
| 900000 | Tejas | INFOSYS |
| 1000000 | Kirtesh | Mahindra |
+---------+------------+----------+
3 rows in set (0.00 sec)
4.
mysql> select a.Order_no, a.Amount, b.Company ,b. Credit_Limit from Orders a, Customers b
where a.Cust=b.Cust_no;
+----------+---------+----------+--------------+
| Order_no | Amount | Company | Credit_Limit |
+----------+---------+----------+--------------+
| 101 | 1500000 | TCS | 50000 |
| 102 | 900000 | INFOSYS | 75000 |
| 103 | 1000000 | Mahindra | 60000 |
| 104 | 400000 | Wipro | 55000 |
+----------+---------+----------+--------------+
4 rows in set (0.00 sec)
5.
mysql> select a.Product ,b.Company from Orders a, Customers b where b.Company='TCS' AND
a.Cust= b.Cust_no; +---------+---------+
| Product | Company |
+---------+---------+
| Laptop | TCS |
+---------+---------+
1 row in set (0.00 sec)
6.
mysql> SELECT a.Company, MAX(b.Disc) AS MaxDiscount FROM Orders b JOIN Customers a
ON b.Cust=a.Cust_no GROUP BY a.Company ORDER BY MaxDiscount Desc LIMIT 1;
+---------+-------------+
| Company | MaxDiscount |
+---------+-------------+
| TCS | 150000 |
+---------+-------------+
1 row in set (0.00 sec)
7.
mysql> SELECT a.Name AS Name1, b.Name AS Name2 FROM Sales_Representative a JOIN
Sales_Representative b ON a.Re_office=b.Re_office AND a.Rep_no<>b.Rep_no;
+-----------+-----------+
| Name1 | Name2 |
+-----------+-----------+
| Kirtesh | Pratik |
| Pratik | Kirtesh |
+-----------+-----------+
2 rows in set (0.00 sec)
8.
mysql> SELECT a.Product, SUM(a.Amount) AS Totalamount FROM Orders a GROUP BY
a.Product HAVING SUM(a.Amount)>400000;
+----------+-------------+
| Product | Totalamount |
+----------+-------------+
| Laptop | 1500000 |
| PC | 900000 |
| Monitors | 1000000 |
+----------+-------------+
3 rows in set (0.00 sec)
9.
mysql> SELECT a.Company AS CustomerName, b.Name AS Rep_Name, c.Amount FROM Orders
c JOIN Customers a ON c.Cust=a.Cust_no JOIN Sales_Representative b ON a.Cust_rep=b.Rep_no
WHERE c.Product='Monitors';
+--------------+----------+---------+
| CustomerName | Rep_Name | Amount |
+--------------+----------+---------+
| Mahindra | Kirtesh | 1000000 |
+--------------+----------+---------+
1 row in set (0.00 sec)
10.
mysql> select a.Company,a. Credit_Limit,b. Disc from Customers a,Orders b where
b.Cust=a.Cust_no;
+----------+--------------+--------+
| Company | Credit_Limit | Disc |
+----------+--------------+--------+
| TCS | 50000 | 150000 |
| INFOSYS | 75000 | 90000 |
| Mahindra | 60000 | 100000 |
| Wipro | 55000 | 40000 |
+----------+--------------+--------+
4 rows in set (0.00 sec)