Page 189 - Informatics_Practices_Fliipbook_Class12
P. 189

Assessment


            A.  Multiple Choice Questions
               1.  Which date function yields the name of the month for a given date or datetime value?
                  a.  MONTH()              b MONTHNAME()          c. DAY()              d. DAYNAME()

               2.  Which text function removes leading spaces (or specified characters) from a string?
                  a.  LTRIM()              b. RTRIM()             c. TRIM()             d. LEFT()

               3.  Which math function is used to round a number to a specified number of decimal places?
                  a.  POWER(x, y)          b. ROUND(x, y)         c. MOD(x, y)          d. UCASE(x)

               4.  Which text function yields the length of a string in terms of characters?
                  a.  MID()                b. LENGTH()            c. INSTR()            d. LTRIM()

               5.  Which date function yields the year component of a given date or datetime value?
                  a.  DATE()               b. YEAR()              c. MONTH()            d. DAY()

            B.  State whether the following statements are True or False:
              1.  UNIQUE and PRIMARY KEY constraints are same.                                            __________
               2.  Attributes cannot be added to an existing table in a database.                         __________
               3.  Using UPDATE-SET command, we can perform conditional updates in a table in MySQL.      __________
               4.  An underscore(_) character along with LIKE operator represents exactly one occurrence of an
                  arbitrary character.                                                                    __________
               5.  A name of a column defined using AS clause in a SELECT statement is known as an alias.   __________
               6.  A primary key attribute can have a NULL value.                                         __________
            C.  Fill in the blanks.
               1.  The SELECT statement, combined with __________ clause, retrieves the records from a MySQL table and displays them
                  without any repetition.
               2.  An attribute in a relation is a foreign key if it is a __________ key in some other table.
               3.  A __________ restricts the values an attribute can take.
               4.  __________ constraint ensures that no two rows have the same value in the specified columns.
               5.  __________ clause is used with the SELECT statement to specify conditions on groups of data to be displayed.
               6.  In case of a nested query, the __________ query may use the result of an __________ query.
               7.  Along with the SELECT statement, the __________ clause is used to display the result of an SQL query in ascending or
                  descending order with respect to specified attribute values.
            D.  Answer the following questions:
               1.  Which of the following statements are true?
                  (i)  Names of the columns in a table must be unique.
                  (ii)  Tuples in a table do not appear in a specific order.
                  (iii)  No component of the primary key can repeat in different tuples in a table.
                  (iv)  DBA decides which tables should be included in the database.
                  (v)  Any tuple can be deleted from any table without affecting the consistency of the database.
                  (vi)  Delete operation changes the database state.
                  (vii)  A failed insert operation does not change the database state.
                  (viii) End-users have no role in the design of the database.
                  (ix)   An end-user decides which components of the database he/she will access.
                  (x)  DBMS may allow a user to access the EMPLOYEE table to a user, but may not allow access to the data relating to
                     employees SALARY>100000.
                  (xi)  DBMS may allow a user to access the salary of the employees in the  EMPLOYEE table, but may not allow access to the
                     Address of the employees.

                                                                                        Database Query using SQL  175
   184   185   186   187   188   189   190   191   192   193   194