Create a table"sales'' in a data base named "exam" then write the command to do the following.
(a)display the salesman no. and salesman name of each record.
(b)display salesman number and salesman amount of North zone .
(c) display the number of salesman in east zone.
(d) display the maximum and minimum sales amount.
(e) display record having sales amount in the range 2 lacs to 3 lacs.
No spam ❌❌❌❌❌❌
OR
Your answer will be reported....
Please help me it is urgent
Answers
Explanation:
- First of all, create the database, for example, CREATE DATABASE exam;
- Now, select the database, such as, USE exam;
- In the database, create the table using the CREATE command.
- Insert the values inside the table.
- Now, run the queries as given below.
SQl commands:
-- creating a database
CREATE DATABASE exam;
-- selecting a database to use
USE exam;
-- creating a table in the database 'exam'
CREATE TABLE sales(Salesman_no integer, Salesman_name text, Sales_zone text, Amount integer);
-- inserting the values in the table 'sales'
INSERT INTO sales VALUES(3001, 'Raju', 'North', 150000);
INSERT INTO sales VALUES(3002, 'Rima', 'South', 200000);
INSERT INTO sales VALUES(3003, 'Neraj', 'East', 250000);
INSERT INTO sales VALUES(3004, 'Somiya', 'North', 287000);
INSERT INTO sales VALUES(3005, 'Monalisa', 'West', 350000);
--(a)
SELECT Salesman_no, Salesman_name FROM sales;
--(b)
SELECT Salesman_no, Amount FROM sales;
--(c)
SELECT count(Salesman_name) FROM sales WHERE Sales_zone = 'East';
--(d)
SELECT min(Amount), max(Amount) Amount FROM sales;
--(e)
SELECT * FROM sales WHERE Amount BETWEEN 200000 AND 300000;
Note: Please, run all the queries to see the output.
#answerwithquality
#BAL