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

Comp check

The document contains a series of SQL-related questions and tasks, including adding a column to a table, correcting a query to find teachers' names, removing rows while maintaining table structure, and differentiating between DELETE and DROP commands. It also includes specific SQL queries to display company names, manipulate customer data, and retrieve accessory information. Additionally, it asks for outputs of various SQL commands related to accessories and shops.

Uploaded by

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

Comp check

The document contains a series of SQL-related questions and tasks, including adding a column to a table, correcting a query to find teachers' names, removing rows while maintaining table structure, and differentiating between DELETE and DROP commands. It also includes specific SQL queries to display company names, manipulate customer data, and retrieve accessory information. Additionally, it asks for outputs of various SQL commands related to accessories and shops.

Uploaded by

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

Question 1:

Write SQL query to add a column total price with datatype numeric
and size 10, 2 in a table product.
Question 2:
Sonal needs to display name of teachers, who have “0” as the third
character in their name. She wrote the following query.
SELECT NAME FROM TEACHER WHERE NAME = “$$0?”;
But the query is’nt producing the result. Identify the problem.
Question 3:
Deepika wants to remove all rows from the table BANK. But he
needs to maintain the structure of the table. Which command is used
to implement the same?
Question 4:
While creating table ‘customer’, Rahul forgot to add column ‘price’.
Which command is used to add new column in the table. Write the
command to implement the same.
Question 5:
What is the use of wildcard?
Question 6:
Differentiate between DELETE and DROP table commands ?
Answer:
Write SQL commands for the queries (i) to (iv) and output for (v) &
(viii) based on a
table COMPANY and CUSTOMER.
1. To display those company name which are having prize less than
30000.
2. To display the name of the companies in reverse alphabetical order.
3. To increase the prize by 1000 for those customer whose name starts
with „S?
4. To add one more column totalprice with decimal] 10,2) to the table
customer
5. SELECT COUNT(*) , CITY FROM COMPANY GROUP BY
CITY;
6. SELECT MIN(PRICE), MAX(PRICE) FROM CUSTOMER
WHERE QTY>10;
7. SELECT AVG(QTY) FROM CUSTOMER WHERE NAME LIKE
“%r%;
8. SELECT PRODUCTNAME,CITY, PRICE FROM COMPANY,
CUSTOMER WHERE COMPANY. CID=CUSTOMER.CID AND
PRODUCTNAME=”MOBILE”;

(a) Write the SQL queries:


1. To display Name and Price of all the Accessories in ascending
order of their Price.
2. To display Id and SName of all Shop located in Nehru Place.
3. To display Minimum and Maximum Price of each Name of
Accessories.
4. To display Name, Price of all Accessories and their respective
SName where they are available.
(b) Write the output of the following SQL
1. SELECT DISTINCT NAME FROM ACCESSORIES WHERE
PRICE>=5000;
2. SELECT AREA, COUNT(*) FROM SHOPPE GROUP BY AREA;
3. SELECT COUNT (DISTINCT AREA) FROM SHOPPE;
4. SELECT NAME, PRICE*0.05 DISCOUNT FROM
ACCESSORIES WHERE SNO IN (‘S0 2 ‘,S0 3 ‘);

You might also like