Professional Documents
Culture Documents
Explanation: We are extracting details from ‘product’ table where V_CODE column
doesn’t hold any value.
3. select * from invoice where INV_SUBTOTAL > 24 and INV_SUBTOTAL<76;
Explanation: We are extracting details from ‘invoice’ table where the condition is that
INV_SUBTOTAL value should be greater than 24 and less than 76. With ‘and’ keyword
we can provide another condition. It will display the information of invoice if both the
conditions are satisfied.
4. select * from invoice where INV_SUBTOTAL = (select min(INV_SUBTOTAL) from
invoice);
Explanation: This query will give you same result as the 6th query, but here we have to
use ‘NOT IN’ keyword.
8. select v.V_CODE, v.V_NAME, count(p.V_CODE) as ‘TOTAL PRODUCTS SUPPLIED’
from vendor v, product p where v.V_CODE==p.V_CODE group by v.V_CODE;
Explanation: This query will display the information like code and name of a vendor
and total count of products each vendor has supplied. ‘count’ is an aggregate function
which gives number of occurrences.
9. select * from emp where EMP_AREACODE==615;
Explanation: This query extracts all the information from ‘emp’ table where
EMP_AREACODE is 615.
10.select p.P_CODE, p.P_DESCRIPT, p.P_INDATE, p.P_QOH, p.P_MIN, p.P_PRICE,
p.P_DISCOUNT, p.V_CODE from product p inner join line l on
p.P_CODE=l.P_CODE where l.LINE_PRIC> 99;
Explanation: Here we are displaying details of product where the line price that is
LINE_PRICE of line table is greater than 99. We have joined the table through inner join
on P_CODE column of ‘product’ table and P_CODE of ‘line’ table.