Assignment #6
DML, DDL, and Views
1) Create an empty table called SECTION2 with the same structure as the SECTION table. Create a
view on the SECTION2 table that will be used for updating the table and restricts updates to sections
with capacities that are less than 25. Write two INSERT statements – one that succeeds and one
that fails and that uses the view to insert into the SECTION2 table.
CREATE TABLE section2 AS
SELECT *
FROM section
WHERE 1=2
2) Create a SQL script file that will
a) Create a view that will display the names of courses taught by Anita Morris
b) Display that data from the view.
You should be able to run the script from the SQL*Plus command line with the @ symbol or the “run”
command.
CREATE OR REPLACE VIEW v_morris AS
SELECT course_no, description
3) Write a table creation script for a table called OWNER. Include the following:
• Column for the owner id; primary key
• Column for the owner username (i.e., the logon name); unique and not null
• Column for the owner’s first name; can be null
• Column for the owner’s last name; can be null