9. Extended Statements : CREATE SCHEMA : Example: Create Schema
 
Share this page                  
Example: Create Schema
Create a schema authorization containing tables, views, and privileges.
create schema authorization joe
create table employees(lname character(30) not null,
                       fname character(30) not null,
                       salary decimal,
                       dname character(10)  
                          references dept(deptname),
                       primary  key  (lname,  fname)
create table dept(deptname character(10)  
                     not null unique,
                  budget decimal,
                  expenses decimal default 0)
create view mgr (mlname, mfname, mdname) as
  select lname, fname, deptname from employees,dept
  where dname = deptname
grant references(lname, fname)
on table employees to harry;