-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsqlquery7.sql
32 lines (28 loc) · 1.92 KB
/
sqlquery7.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Information about the table:
Table Customer:
+---------+------------------+-----------------------+--------+-----------+---------+----------------+
| cust_id | cname | Address | Gender | City | Pincode | TotalOrdersYet |
+---------+------------------+-----------------------+--------+-----------+---------+----------------+
| 546 | Rakesh Matam | Bongora, kamrup rural | M | Guwahati | 781015 | 3 |
| 1111 | Kuldeep Ravaliya | Bongora, kamrup rural | M | Guwahati | 781015 | 7 |
| 670 | Sugam Sehgal | Lajpat Nagar | M | Jalandhar | 144001 | 2 |
| 1110 | Sumit Mishra | Bongora, kamrup rural | M | Guwahati | 781015 | 1 |
| 890 | Lokesh Daga | Ashok Nagar | M | Jalandhar | 144003 | 4 |
| 700 | Riya Gupta | Dilbagh Nagar | F | Jalandhar | 144002 | 5 |
| 1251 | Ram Kumar | Dilbagh Nagar | M | Jalandhar | 144002 | 1 |
| 1300 | Shayam Singh | Ludhiana H.O | M | Ludhiana | 141001 | 15 |
| 245 | Neelabh Shukla | Ashok Nagar | M | Jalandhar | 144003 | 10 |
| 210 | Barkha Singh | Dilbagh Nagar | F | Jalandhar | 144002 | 1 |
| 500 | Rohan Arora | Ludhiana H.O | M | Ludhiana | 141001 | 7 |
+---------+------------------+-----------------------+--------+-----------+---------+----------------+
Problem Statement:
List out the minimum number of orders made from a particular Gender.
Solution:
SELECT GENDER, MIN(TOTALORDERSYET) FROM CUSTOMER GROUP BY GENDER;
Output:
+--------+---------------------+
| GENDER | MIN(TOTALORDERSYET) |
+--------+---------------------+
| M | 1 |
| F | 1 |
+--------+---------------------+