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

Mark Analysis

The document outlines the creation and management of a MySQL database named ANEES14, including the creation of a SALES table to track product sales. It provides various SQL queries to analyze sales data, such as total quantity sold, average quantity, and price statistics. The results indicate that Widget A, Widget B, and Widget C have significant sales quantities, with total sales of 35 items recorded.

Uploaded by

aneesanees35848
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)
2 views3 pages

Mark Analysis

The document outlines the creation and management of a MySQL database named ANEES14, including the creation of a SALES table to track product sales. It provides various SQL queries to analyze sales data, such as total quantity sold, average quantity, and price statistics. The results indicate that Widget A, Widget B, and Widget C have significant sales quantities, with total sales of 35 items recorded.

Uploaded by

aneesanees35848
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

( STUDENT MARK ANALYSIS )

mysql> CREATE DATABASE ANEES14;


Query OK, 1 row affected (0.00 sec)

mysql> USE ANEES14;


Database changed
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| anee |
| anees |
| anees14 |
| aneesh |
| arun |
| ash |
| ashee_info |
| avinash |
| collage_info |
| college |
| college__info |
| college_info |
| data |
| factorial |
| govt |
| mysql |
| school |
| stu14 |
| student14 |
+--------------------+
20 rows in set (0.00 sec)

mysql> CREATE TABLE SALES(id INT AUTO_INCREMENT PRIMARY KEY,product


VARCHAR(50),quantity INT,price DECIMAL(10,2));
Query OK, 0 rows affected (0.08 sec)

mysql> INSERT INTO SALES(product,quantity,price)VALUES('Widget A',10,2.50),('Widget


B',5,3.00),('Widget C',8,1.75),('Widget B',3,3.00),('Widget A',7,2.50),('Widget C',2,1.75);
Query OK, 6 rows affected (0.03 sec)
Records: 6 Duplicates: 0 Warnings: 0

mysql> SELECT *FROM SALES;


+----+----------+----------+-------+
| id | product | quantity | price |
+----+----------+----------+-------+
| 1 | Widget A | 10 | 2.50 |
| 2 | Widget B | 5 | 3.00 |
| 3 | Widget C | 8 | 1.75 |
| 4 | Widget B | 3 | 3.00 |
| 5 | Widget A | 7 | 2.50 |
| 6 | Widget C | 2 | 1.75 |
+----+----------+----------+-------+
6 rows in set (0.02 sec)

mysql> SELECT SUM(QUANTITY)FROM SALES;


+---------------+
| SUM(QUANTITY) |
+---------------+
| 35 |
+---------------+
1 row in set (0.00 sec)

mysql> SELECT COUNT(*)FROM SALES;


+----------+
| COUNT(*) |
+----------+
| 6|
+----------+
1 row in set (0.00 sec)

mysql> SELECT AVG(QUANTITY)FROM SALES;


+---------------+
| AVG(QUANTITY) |
+---------------+
| 5.8333 |
+---------------+
1 row in set (0.00 sec)

mysql> SELECT MAX(PRICE)FROM SALES;


+------------+
| MAX(PRICE) |
+------------+
| 3.00 |
+------------+
1 row in set (0.00 sec)

mysql> SELECT MIN(PRICE)FROM SALES;


+------------+
| MIN(PRICE) |
+------------+
| 1.75 |
+------------+
1 row in set (0.02 sec)

mysql> SELECT product,SUM(quantity)as product_quantity FROM SALES GROUP BY product


HAVING sum(quantity)>5;
+----------+------------------+
| product | product_quantity |
+----------+------------------+
| Widget A | 17 |
| Widget B | 8|
| Widget C | 10 |
+----------+------------------+
3 rows in set (0.00 sec)

You might also like