Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 47 - Modular_V2.0_SQL_Flipbook
P. 47

    Recap

                            Aliases are used to give a table or column, a temporary name.
                             The GROUP BY clause will be very helpful in making subgroups to understand the data better.

                              The HAVING clause is used in the criteria for retrieving records with aggregate functions along
                            with GROUP BY.

                              The ORDER BY keyword is used to sort the values in ascending or descending order.
                              Function is a set of predefined commands that perform specific operation to return a value to

                            the program.

                                                              Exercise

                     A.   Tick ( ) the correct option.
                        1.  If we have not specified ASC or DESC after a SQL ORDER BY clause, the ………………… is used by default.

                           a.  DESC                                         b.  ASC
                           c.  Default                                      d.  None of these
                        2.  Which of the following functions is helpful in finding the maximum value in the given set of values?

                           a.  MAX()                                        b.  MIN()
                           c.  COUNT()                                      d.  NOW()

                        3.   Which of the following function helps to count the number of records or values in a specified column/
                           expression?

                           a.  Min()                                        b.  Max()
                           c.  Count()                                      d.  Sum()

                        4.  What output will the following query display?

                           SELECT * FROM Marks WHERE Roll_No<>2;
                           a.  Display the records of students whose Roll No 2.
                           b.  Display the records of students except Roll No 2.
                           c.  Display the records of students related to No 2.

                           d.  None of these
                        5.  Which of the following clauses allow the sorting of query results by one or more columns?

                           a.  Update                                       b.  Drop
                           c.  Alter                                        d.  Order By

                     B.  Write 'T' for true and 'F' for false.
                        1.  The DESC attribute is used to describe the table structure.                         ……………………

                        2.  Sum() is an example of date function.                                               ……………………
                        3.  Alias is a temporary name given to a table.                                         ……………………

                        4.  Compute() is a valid aggregate function.                                            ……………………
                        5.  SIGN() function returns the sign of a given number.                                 ……………………

                                                                                                                         45
                                                                                                        More on MySQL

| 42 43 44 45 46 47 48 49 50 51 52 |