Page 193 - IT-802_class_12
P. 193

Select appropriate option to display average price of products less than 500.00
                  (a)  Select prod_name, avg(price) from product group by prod_name where avg(price)<500.00;
                  (b)  Select prod_name, avg(price) from product group by prod_name having avg(price)<=500.00;
                  (c)  Select prod_name, avg(price) from product group by prod_name having avg(price)<500.00;
                  (d)  Select prod_name, avg(price) from product group by prod_name where price<500.00
             Ans.  (d)  Select prod_name, avg(price) from product group by prod_name where price<500.00
              34.  Consider the table Product in Q16 and select the query to display records of P111, P123 and belong to either ‘Delhi’ or
                 ‘Lucknow’.                                                                                    [2022]
                  (a)  Select *from Product where P_ID in (‘P111’, ‘P123’) and City in (‘Delhi’, ‘Lucknow’);
                  (b)  Select *from Product where P{ID in (‘P111’, ‘P123’) and City in (‘Delhi’, ‘Lucknow’);
                  (c)  Select *from Proeuct where P_ID in (‘P111’, ‘P123’) and City in (‘Delhi’, ‘Lucknow’);
                  (d)  Select *from Product where P_ID in (‘P111’, ‘P123’) or City in (‘Delhi’, ‘Lucknow’);
             Ans.  (d)  Select *from Product where P_ID in (‘P111’, ‘P123’) or City in (‘Delhi’, ‘Lucknow’);
              35.  Consider the table Supplier in Q16 and select appropriate query to display Supplier name and product name for all the
                 products:                                                                                     [2022]
                  (i)  Select Sup_ID, Prod_name from Product P. Supplier S where P.P_ID=S.P_ID;
                  (ii)  Select Sup_ID, S_name from Product P. Supplier S where P.P_ID=S.P_ID;
                  (iii)  Select s_name, Prod_name from Product P, Supplier S where p.P_ID=S.P_ID;
                  (iv)  Select P_ID,S_name from Product P, Supplier S where P.P_ID=S.P_ID;
                  (a)  Only (i)                                (b)  (ii) and (iii)
                  (c)  Only (iii)                              (d)  (i) and (iv)
             Ans.  (c)  Only (iii)
              36.  Consider  the  table  Product  and  give  appropriate  command  to  change  the  datatype  of  column  P_ID  from  char(20)  to
                 varchar (20)                                                                                  [2022]
                  (a)  Update table Product set P_ID varchar (20);   (b)  Alter table Product set P_ID varchar (20);
                  (c)  Alter table Product update O_ID varchar (20);   (d)  Alter table Product modity P_ID varchar (20);
             Ans.  (b)  Alter table Product set P_ID varchar (20);




































                                                                                 Database Concepts—RDBMS Tool   191
   188   189   190   191   192   193   194   195   196   197   198