Quiz #2

Problem #1:

Explain the structure of the view that is created in the following example. Also explain what is meant by CREATE OR REPLACE. What are the values and cautions associated with this command?
SQL> CREATE OR REPLACE VIEW don_drive
  2  AS
  3  SELECT idno, d.driveno, drivename, drivechair, contamt
  4  FROM donation m, drive d
  5 WHERE m.driveno = d.driveno;

Problem #2:

Explain the structure of the view that is created in the following example.
SQL> CREATE VIEW dona_view
  2     (drive_no, drive_name, contribution)
  3  AS
  4  SELECT d.driveno, drivename, contamt
  5  FROM drive d, donation m
  6  WHERE d.driveno = m.driveno;

Problem #3:

What would be produced? Explain!
SQL> SELECT *
  2  FROM donor
  3  WHERE contact =
  4     (SELECT contact
  5      FROM donor
  6      WHERE idno = '23456')
  7  AND yrgoal >
  8     (SELECT MIN(yrgoal)
  9      FROM donor);

Problem #4:

What would be produced? Explain!
SQL> SELECT * FROM donation
  2  WHERE driveno IN
  3     (SELECT driveno
  4      FROM drive
  5      WHERE lastyear > 5000);

Problem #5:

Set up a sequence and set up a table. Use the sequence to put data into one of the fields on the table. Enter 4 records. Explain the processing.