Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Homework : week 5

1.

Write commands in SQL for (i) to (viii):


(i) To increase the price of “Amlodipine” by 50.
(ii) To display all those medicines whose price is in the range 100 to 150.
(iii)To display the Maximum price offered by pharmacy located in “Gurgaon”
(iv) To display the Drug ID, DrugName and Pharmacy Name of all the records in descending order of
their price.
(v)To display sum of price for each PharmacyName having more than 1 drug.
(vi) to display Maximum and Minimum price
(vii) to display all details of PharmaDB in descending order of DrugId.
(viii)To display average price for all Delhi based locations.

Write the output(s) produced by executing the following queries:


(ix) SELECT RxID, DrugName, Price from PharmaDB where PharmacyNa IN (“Rx Parmacy”, “Raj
Medicos”);
(x) SELECT PharmacyName, COUNT(*) FROM PharmaDB GROUP BY PHARMACY NAME

2. What is the difference between group by and order by clause of MYSQL?


3. What is degree and cardinality of a relation.
4. Find the error in the following command:
Select * from Employee where Comm=Null;
5. If a database “Library” exists, which MySql command helps you to start working in that
database?
6. Rajiv wants to remove all the rows from the table “Flight” but does not want to remove the
structure of the table. Which command he should use?
7. While creating a table “Voter”, Kavita forgot to set primary key for the table. Write the
statement to set the column VoterID as the primary key of the table.
8. Sunil wants to see the unique city names from the city column of student table. Write the command.
9. List any two clauses that can be used with Select statement. Explain their usage.
10. Rewrite the following SQL statement after correcting error(s). Underline the corrections made.
INSERT IN EMP(EMPNO, SALES) VALUE (100, 20078.50);

You might also like