0% found this document useful (0 votes)
4 views3 pages

Assignment - 4

This is a python assignment 4 of hansrajnodel school
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Assignment - 4

This is a python assignment 4 of hansrajnodel school
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

PRACTICLA ASSIGNMENT - 4

Q-1

mysql> SELECT CATEGORY, SUM(QTY) AS Total_Quantities FROM STOCK GROUP BY CATEGORY;

+----------+------------------+

| CATEGORY | Total_Quantities |

+----------+------------------+

| IO | 25 |

| NW | 8|

| OO | 14 |

+----------+------------------+

3 rows in set (0.01 sec)

Q-2

mysql> SELECT CATEGORY,AVG(PRICE) as AVERAGE_PRICE_CATEGORY_WISE FROM STOCK GROUP


BY CATEGORY;

+----------+-----------------------------+

| CATEGORY | AVERAGE_PRICE_CATEGORY_WISE |

+----------+-----------------------------+

| IO | 400.0000 |

| NW | 3300.0000 |

| OO | 10750.0000 |

+----------+-----------------------------+

3 rows in set (0.01 sec)

Q-3

mysql> SELECT CATEGORY,MAX(PRICE) as MAXIMUM_PRICE_CATEGORY_WISE FROM STOCK GROUP


BY CATEGORY;

+----------+-----------------------------+
| CATEGORY | MAXIMUM_PRICE_CATEGORY_WISE |

+----------+-----------------------------+

| IO | 450 |

| NW | 3600 |

| OO | 17000 |

+----------+-----------------------------+

3 rows in set (0.01 sec)

Q-4

mysql> SELECT CATEGORY,COUNT(*) FROM STOCK WHERE CATEGORY IN ("IO","OO") GROUP BY


CATEGORY ;

+----------+----------+

| CATEGORY | COUNT(*) |

+----------+----------+

| IO | 2|

| OO | 2|

+----------+----------+

2 rows in set (0.00 sec)

Q-5

mysql> SELECT DISTINCT CATEGORY,COUNT(*) FROM STOCK GROUP BY CATEGORY;

+----------+----------+

| CATEGORY | COUNT(*) |

+----------+----------+

| IO | 2|

| NW | 2|

| OO | 2|

+----------+----------+

3 rows in set (0.00 sec)


Q- 6

mysql> SELECT DISTINCT CATEGORY,COUNT(*) FROM STOCK GROUP BY CATEGORY ;

+----------+----------+

| CATEGORY | COUNT(*) |

+----------+----------+

| IO | 2|

| NW | 2|

| OO | 2|

+----------+----------+

3 rows in set (0.00 sec)

Q-7

mysql> SELECT CATEGORY,MAX(PRICE) AS MAXIMUM_PRICE_CORRESPONDIG_TO_CATEGORY FROM


STOCK WHERE QTY > 1 GROUP BY CATEGORY;

+----------+----------------------------------------+

| CATEGORY | MAXIMUM_PRICE_CORRESPONDIG_TO_CATEGORY |

+----------+----------------------------------------+

| IO | 450 |

| NW | 3600 |

| OO | 17000 |

+----------+----------------------------------------+

3 rows in set (0.01 sec)

You might also like