SQL Commands Exercise
SQL Commands Exercise
Ex.No: 20
DATE:
AIM:
To write Queries for the following Questions based on the given table:
USE STUDENTS;
SHOW DATABASES;
(e) Write a Query to List all the tables that exists in the current database.
SHOW TABLES;
Output:
35
SQL COMMANDS EXERCISE - 2
Ex.No: 21
DATE:
AIM:
To write Queries for the following Questions based on the given table:
STU:
Rollno Name Gender Age Dept DOA Fees
1 Arun M 24 COMPUTER 1997-01-10 120
2 Ankit M 21 HISTORY 1998-03-24 200
3 Anu F 20 HINDI 1996-12-12 300
4 Bala M 19 NULL 1999-07-01 400
5 Charan M 18 HINDI 1997-09-05 250
6 Deepa F 19 HISTORY 1997-06-27 300
7 Dinesh M 22 COMPUTER 1997-02-25 210
8 Usha F 23 NULL 1997-07-31 200
(b) Write a Query to display all the details of the Employees from the above table 'STU'.
Output:
36
(c) Write a query to display Rollno, Name and Department from STU table.
Output:
Output:
Output:
********************************************************************************************
37
Ex.No: 22 SQL COMMANDS EXERCISE - 3
DATE:
AIM:
To write Queries for the following Questions based on the given table:
Output:
(b) Write a Query to list name of the students whose age’s are between 18 to 20.
Output:
38
(c) Write a Query to display the names of the students whose name is starting with 'A'.
Output:
(d) Write a query to list the names of those students whose name have second alphabet 'n' in their
names.
Output:
**********************************************************************************************************
39
Ex.No: 23 SQL COMMANDS EXERCISE - 4
DATE:
AIM:
To write Queries for the following Questions based on the given table:
(b) Write a Query to change the fess of Student to 170 whose Roll number is 1, if the existing fess
is less than 130.
Output(After Update):
40
(c) Write a Query to add a new column named Area of type varchar in table STU.
Output:
(d) Write a Query to Display Name of all students whose Area Contains NULL.
Output:
(e) Write a Query to delete Area Column from the table STU.
Output:
Output:
*******************************************************************************************
41
Ex.No: 24 SQL COMMANDS EXERCISE - 5
DATE:
AIM:
To write Queries for the following Questions based on the given table:
TABLE: UNIFORM
TABLE: COST
(a) To Display the average price of all the Uniform of Raymond Company from table COST.
Output:
(b) To display details of all the Uniform in the Uniform table in descending order of Stock date.
Output:
42
(c) To Display max price and min price of each company.
Output:
(d) To display the company where the number of uniforms size is more than 2.
Output:
(e) To display the Ucode, Uname, Ucolor, Size and Company of tables uniform and cost.
Output:
*****************************************************************************************
43