Db2 Basics, Part 3

46 Questions | Total Attempts: 58

SettingsSettingsSettings
Please wait...
Database Quizzes & Trivia

Questions and Answers
  • 1. 
    The ________ data type stores data such as images, audio, and video.
  • 2. 
    The CLOB data type stores single-byte character set (SBCS) or multibyte character set string values.
    • A. 

      True

    • B. 

      False

  • 3. 
    ________ let you place logic to enforce business rules within the database, rather than in applications.
  • 4. 
    Constraints are ________ that govern     1.  how data values can be ________ to a table, and     2.  how data values in a table can be ________.
  • 5. 
    Constraints are usually defined during table ________; they can also be added to existing tables with the ________ ________ statement.
  • 6. 
    Unique constraint versus unique index:  Which are the characteristics of a UNIQUE constraint?
    • A. 

      Generally cannot be used in a referential constraint

    • B. 

      Does not allow NULL values

    • C. 

      Enforces uniqueness

    • D. 

      Can be referenced in a referential constraint

    • E. 

      Allows NULL values

  • 7. 
    Unique constraint versus unique index:  Which are the characteristics of a unique index?
    • A. 

      Does not allow NULL values

    • B. 

      Generally cannot be used in a referential constraint

    • C. 

      Allows NULL values

    • D. 

      Can be referenced in a referential constraint

    • E. 

      Enforces uniqueness

  • 8. 
    A ________ column is a unique identifier that represents an individual table record.  Its value is a number sequentially incremented with each new record.
  • 9. 
    To create a table with the same definition as an existing table, use the statement     CREATE TABLE [TableName] ________ [SourceTable] ...
  • 10. 
    When using the LIKE clause to create a table with the same definition as an existing table, indicate which of the following are true:
    • A. 

      UNIQUE constraints are copied.

    • B. 

      Default constraints are copied (unless EXCLUDING COLUMN DEFAULTS is specified).

    • C. 

      Referential constraints are copied.

    • D. 

      Both tables have the same number of columns.

    • E. 

      Triggers are copied.

    • F. 

      Indexes are copied.

    • G. 

      The columns in the new table have the same names, data types, and nullability features.

  • 11. 
    CREATE TABLE project    (projno         CHAR(6)  NOT NULL.     projname    VARCHAR(24)  NOT NULL,     deptno        SMALLINT,     budget        DECIMAL(6,2),     startdate     DATE,     enddate      DATE)          The table will be created in table space ________ (the default).     Values must be provided for fields ________ and ________.
  • 12. 
    CREATE TABLE central.sales    (po_number     INTEGER  NOT NULL  CONSTRAINT uc1 UNIQUE,     date                DATE       NOT NULL  WITH DEFAULT,     office              CHAR(128)  NOT NULL  WITH DEFAULT 'Dallas',     amt                DECIMAL(10,2)  NOT NULL  CHECK (amt > 99.99))   IN my_space     Must provide values for fields ________ and ________.  An index was provided for field ________.  The default for the date field is the ________ ________.  The sales table will be created in schema ________ and table space ________.  
  • 13. 
    CREATE TABLE payroll.employees      (empid             INTEGER  NOT NULL  PRIMARY KEY,       emp_fname    CHAR(30),       emp_lname    CHAR(30))  CREATE TABLE payroll.paychecks      (empid               INTEGER,       weeknumber    CHAR(3),       pay_amt           DECIMAL(6,2),       CONSTRAINT fkconst  FOREIGN KEY (empid)             REFERENCES employee(empid)  ON DELETE CASCADE,       CONSTRAINT chk1  CHECK (pay_amt > 0  AND  weeknumber BETWEEN 1 AND 52))  For table 'employees':       Values must be provided for ________.       Every value provided for ________ must be unique.       An index was provided for the ________ column.  For table 'paychecks':       pay_amt has a ________ of 6 and a ________ of 2.       Every value in paychecks.________ must have a matching value in employees.________, due to CONSTRAINT ________.       Whenever a row is ________ from table employees, all rows in table paychecks that have the same value will also be ________.   
  • 14. 
    CREATE TABLE employee      (empid            SMALLINT  NOT NULL  GENERATED BY DEFAULT AS IDENTITY,       firstname       VARCHAR(30)  NOT NULL,       lastname       VARCHAR(30)  NOT NULL,       deptid            CHAR(3),       edlevel          CHAR(1)  CHECK(edlevel IN ('C','H','N')),       CONSTRAINT  emp_pk  PRIMARY KEY (empid),       CONSTRAINT  emp_dept_fk  FOREIGN KEY (deptid)                 REFERENCES department(deptno))  'empid' is a ________ column.  Values must be supplied for fields ________ and ________.  Constraints are not named when they are part of the ________ definition, as for field ________.  Every value entered in field ________ must be unique, due to its constraint.  An index was created for field ________, due to its constraint.  Every value entered entered in field ________ must have a matching value in the ________ field of table ________, due to referential constraint ________.  
  • 15. 
    CREATE TABLE stock.activity      (activityno   SMALLINT  NOT NULL  GENERATED BY DEFAULT AS IDENTITY                 (START WITH 10  INCREMENT BY 10),       actkwd       CHAR(6)      NOT NULL,       actdesc      VARCHAR(20)  NOT NULL,       UNIQUE (activityno))  'activityno' is a ________ column.  Values must be provided for columns ________ and ________.  An index is created for column ________.  In 'stock.activity', 'stock' identifies the ________.  
  • 16. 
    CREATE TABLE self_reference      (idcol1     SMALLINT  NOT NULL  PRIMARY KEY,       idcol2     SMALLINT,       CONSTRAINT fkconst  FOREIGN KEY (idcol2)                 REFERENCES self_reference(idcol1))  Every value in column ________ must have a matching value in column ________, due to constraint ________.  ________ is the parent key, and ________ is the foreign key.  Every value of column ________ must be unique.  A ________ was created for column idcol1, due to the PRIMARY KEY constraint.  Table self_reference will be created in table space ________.  
  • 17. 
    Which are the characteristics of base tables?
    • A. 

      Table name must be unique within a schema.

    • B. 

      Not persistent - only used by the application that created it.

    • C. 

      Only used for the life of the application.

    • D. 

      Descriptions and constraints stored in system catalog tables of the database.

    • E. 

      Many apps can create a table with the same name.

  • 18. 
    Which are the characteristics of declared temporary tables?
    • A. 

      Not persistent - only used by the application that created it.

    • B. 

      Descriptions and constraints stored in system catalog tables of the database.

    • C. 

      Many apps can create a table with the same name.

    • D. 

      Only used for the life of the application.

    • E. 

      Table name must be unique within a schema.

  • 19. 
    The GENERATED ... AS IDENTITY clause may be used when creating a declared temporary table.
    • A. 

      True

    • B. 

      False

  • 20. 
    The contents of a declared temporary table may be retained after a transaction is committed.
    • A. 

      True

    • B. 

      False

  • 21. 
    A ________ is an ordered set of ________ that refers to rows in a base table.
  • 22. 
    An index is based on one or more columns, known as the ________, in the base table.
  • 23. 
    To create an index, you must use the CREATE INDEX statement.
    • A. 

      True

    • B. 

      False

  • 24. 
    Using the CREATE INDEX statement, secondary columns may be stored in the index along with the key.
    • A. 

      True

    • B. 

      False

  • 25. 
    Data uniqueness is automatically enforced when an index is created with the CREATE INDEX statement.
    • A. 

      True

    • B. 

      False

Related Topics
Back to Top Back to top