0% found this document useful (0 votes)
85 views

SQL Queries

Uploaded by

sidhusarrvesh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views

SQL Queries

Uploaded by

sidhusarrvesh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

1.

Write SQL queries for the following Questions based on the given table:

(a) Write a Query to select distinct Department from Info table.

(b) Write a Query to show all information about students of History department.

(c) Write a Query to list name of the students whose ages are between 18 to 20.

(d) Write a Query to display the name of the students whose name is starting with 'A'.

2. Write SQL queries for the following Questions based on the given table:

(a) Write a Query to delete the details of Roll number is 8

(b) Write a Query to change the fees of Student to 170 whose Roll number is 1, if the existing fess

is less than 130.

(c) Write a query to list the names of those students whose name have second alphabet 'n' in their

names.

(d) Write a Query to list name of female students in Hindi Department.

3. Write SQL queries for the following Questions based on the given table: (4)
(a) Write a Query to add a new column Area of type varchar in table STU.

(b) Write a Query to Display Name of all students whose Area Contains NULL.

(c) Write a Query to delete Area Column from the table STU.

(d) Write a Query to delete table from Database.

4. Write SQL queries for the following Questions based on the given table:

(a) Write a query to display details of all products in the stock table in descending order of Stock date.

(b) Write a query to delete the details of the product coded 5003.

(c) Write a query to change the unit price of product to 8 whose product number is 5002, if the existing

price is less than 5.

(d) Write a query to add a new column PType of type varchar in table STOCK.

5. Write SQL queries for the following Questions based on the given table:

(a) Write a query to display details of all products in the stock table in ascending order of Pname.

(b) Write a query to delete the details of the product coded 5006.
(c) Write a query to change the unit price of product to 8 whose product number is 5001, if the existing

price is less than 5.

(d) Write a Query to display the name of the products whose name contains ‘pen’.

6. Consider the following tables CLUB and MEMBER and answer (a) to (d)

(a) To display the name of all Games with their Gcode.


(b) To display details of those games which are having Fees more than 7000.
(c) To display the player name and his game with respect to Gcode.
(d) Write the output for the query: Select COUNT( DISTINCT Number) from CLUB;
7. Write SQL queries for the following Questions based on the given table:

(a) Write a Query to select female students from Info table.

(b) Write a Query to show all information about students of Hindi department.

(c) Write a Query to list name of the students whose fees are between 200 to 300.
(d) Write a Query to display the name of the students whose name is starting with 'D'.

8. Consider the following tables CLUB and MEMBER and answer (a) to (d)

(a) To display the name of all Games with their Gcode.


(b) To display details of those games which are having Fees more than 7000.
(c) To display the player name and his game with respect to Gcode.
(d) Write the output for the query: Select COUNT( DISTINCT Number) from CLUB;
9. Write SQL queries for the following Questions based on the given table:

(a) Write a Query to Create a new database in the name of "STOCK" and to to Open the database

"STOCK".

(b) Write a Query to create the above table called: Product.

(c) Write a Query to insert all the rows of above table into Product table.

(d) Write a query to display Pno, Pname and Quantity of the products from Product table.
10. Write SQL queries for the following Questions based on the given table:

(a) Write a Query to Create a new database in the name of "STUDENTS" and to to Open the database

"STUDENTS".

(b) Write a Query to create the above table called: Info.

(c) Write a Query to insert all the rows of above table into Info table.

(d) Write a query to display Rollno, Name and Department of the students from Info table.

11. Write SQL queries for the following Questions based on the given table:

(a) Write a query to display details of all products in the stock table in descending order of Unit Price.

(b) Write a query to delete the details of the product coded 5009.

(c) Write a query to change the unit price of product to 15 whose product number is 5005.

(d) Write a query to add a new column PType of type varchar in table STOCK.

You might also like