Page 200 - Informatics_Practices_Fliipbook_Class12
P. 200

21.  Consider the following table Table : SALESMAN                                               [2022]

                                                      Table : Salesman
                             Scode         Sname          Area          Qtysold      Dateofjoin
                             S001           Ravi          North          120         2015-10-01

                             S002         Sandeep         South          105         2012-08-01
                             S003           Sunil         NULL            68         2018-02-01
                             S004           Subh          West           280         2010-04-01
                             S005           Ankit          East           90         2018-10-01

                             S006          Raman          North          NULL        2019-12-01
               Predict the output for the following SQL queries:
              (i)   SELECT MAX(Qtysold), MIN(Qtysold) FROM SALESMAN;
              (ii)  SELECT COUNT (Area) FROM SALESMAN;
              (iii)  SELECT LENGTH (Sname) FROM SALESMAN WHERE MONTH(Dateofjoin)=10
              (iv)  SELECT Sname FROM SALESMAN WHERE RIGHT(Scode, 1)=5;
                                                           OR
               Based on the given table SALESMAN write SQL queries to perform the following operations:
              (i)   Display the maximum qtysold from each area.
              (ii)  Count the total number of salesman.
              (iii)  Display the average qtysold from each area where number of salesman is more than 1.
              (iv)  Display all the records in ascending order of area.

         Ans.  (i)   MAX(Qtysold)      MIN(Qtysold)
                         280                68

              (ii)
                     COUNT(AREA)
                           5

              (iii)
                     LENGTH(SNAME)
                            4
                            5

              (iv)       SNAME

                          Ankit



                                                       Answers

          Multiple Choice Questions
          1. (d)      2. (b)     3. (b)     4. (b)      5. (d)     6. (a)     7. (a)      8. (a)     9. (a)
          10. (c)
          True or False
          1. (T)      2. (F)     3. (T)     4. (F)      5. (T)     6. (F)     7. (T)
          Fill in the blanks
          1. structure          2. domain            3. 1                  4. ; (semicolon)
          5. DROP TABLE         6. ALTER TABLE


          186  Touchpad Informatics Practices-XII
   195   196   197   198   199   200   201   202   203   204   205