Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

SQL-REVIEW ASSESSMENT-II Duration: 2 hrs

1. Write a query to display number of suppliers.


2. Write a query to display supplier details, those who have a character ‘a’ in his name at-
least twice.
3. Write a query to display the below details: Purchase_line_id, Item_id, Item_description,
qty, and rate.
4. Write a query to update the below details in PURCHASE_LINE_DTLS
ITEM_AMT = QTY*RATE
GST_AMT =ITEM_AMT*(GST_RATE/100) – GST_RATE to be taken from
ITEM_MASTER for a given item
TOTAL_AMT = ITEM_AMT +GST_AMT

5. Update the TOTAL in PURCHASE_DTLS with the calculated amount from the previous
query.
6. Display month wise Total purchase from PURCHASE_DTLS
7. Display Item_ID and No. of times purchased from PURCHASE_LINE_DTLS only for the
items which are purchased at least twice.
8. Display Supplier name and No. of character in their names.
9. Create a view with the below columns:
ITEM_ID, ITEM_DESCRIPTION, OPENING_BALANCE, TOTAL_PURCHASE,
CURRENT_STOCK
TOTAL_PURCHASE : SUM(qty) from PURHCASE_LINE_DTLS for an item
CURRENT_STOCK = OPENING_BALANCE+TOTAL+PURCHASE
10. Explain the difference between the two statements given below (explain in detail)
a. SELECT empno, name, sal FROM emp1
UNION
SELECT empno, name, sal FROM emp2;

b. SELECT empno, name, sal FROM emp1


UNION ALL
SELECT empno, name, sal FROM emp2;

You might also like