Page 183 - Informatics_Practices_Fliipbook_Class12
P. 183

NOW(): yields the current date and time.
                  DATE(): extracts the date portion from a given date or datetime value.
                  MONTH(): yields the month component of a given date or datetime value as an integer (1 to 12).
                  MONTHNAME(): yields the name of the month for a given date or datetime value.
                  YEAR(): yields the year component of a given date or datetime value.

                  DAY(): yields the day of the month for a given date or datetime value.
                  DAYNAME(): yields the name of the weekday for a given date or datetime value.
                  Nested query: When an SQL query encloses another query, the outer query may use the result of the inner
              Ø
                  query.
                  BETWEEN operator checks whether a  value is within a specified range. It may be applied to numbers, text,
              Ø
                  and dates.
                  IN operator checks whether a  value is within a set.
              Ø
                  LIKE operator uses wildcard operators % and _ to define a pattern.
              Ø
                  GROUP BY clause: Used to output groupwise summary data.
              Ø
                  HAVING clause: Used to group the data so that the group as a whole satisfies a condition.
              Ø




                                                  Solved Exercise


            A.  Multiple Choice Questions
               1.  Which of the following is a feature of a Primary Key attribute?
                  a.  uniqueness           b. NOT NULL            c. No repetition      d. All of the above

               2.  Which of the following describes the degree of a relation?
                  a.  Number of rows present in that relation.
                  b.  Number of columns present in that relation.
                  c.  Average number of rows in that relation
                  d.  Count of numeric fields in a relation

               3.  Which non-primary attributes of a table refers to the primary key of another table?
                  a.  Alternate Key
                  b.  Foreign Key
                  c.  Candidate Key
                  d.  NOT NULL key
               4.  What does a NOT NULL constraint on an attribute in a table ensure?
                  a.  That the  attribute cannot have a  NOT NULL  value
                  b.  That the attribute cannot have a  NULL value
                  c.  That the attribute cannot have zero value
                  d.  That the attribute cannot have non-zero value.
               5.  The term Relation in an RDBMS denotes a __________.
                  a.  Database             b. Query               c. File               d. Table
               6.  Which math function is used to calculate the value of x raised to the power of y?
                  a.  POWER(x, y)          b. ROUND(x, y)         c. MOD(x, y)          d. UCASE(x)




                                                                                        Database Query using SQL  169
   178   179   180   181   182   183   184   185   186   187   188