You are on page 1of 1

// create the new table.

// recommended to run then clear the worksheet

create table department(


depNum number(3) not null,
depName varchar(12) not null,
loc varchar(12) not null,
primary key(depNum)
);

insert into department


values (10, 'Accounting', 'New York');

insert into department


values (20, 'Research', 'Dallas');

// view all objects -> '*' all


select * from department

insert into employees


values (7839, 'King', 'President', NULL, '17-NOV-1981', 5000,NULL, 10);

insert into employees


values (7839, 'King', 'President', NULL, to_date('17-DEC-1980', 'DD-MON-YYYY'),
5000,NULL, 10);

update vendor
set vendorName='MGB Enterprises'
where vendorId='DL'; // without this statement all rows change

create table Product(


productId varchar2(5) not NULL,
productName varchar2(30) not NULL,
vendorId varchar2(5) not null,
unitPrice number(8,2),
foreign key(vendorId) references vendor,
primary key(productId)
)

You might also like