You are on page 1of 2

create table Goods( good_no integer CONSTRAINT pk_good_no PRIMARY KEY, good_name text(31), quality text(11) ); create table

Receptions( reception_id integer CONSTRAINT pk_reception_id PRIMARY KEY, reception_date date ); create table ReceptionsMaterials( reception_id integer CONSTRAINT fk_reception_id REFERENCES Receptions(reception_id), good_no integer CONSTRAINT fk_good_no REFERENCES Goods(good_no), quantity number, price number, CONSTRAINT pk_reception_id_good_no PRIMARY KEY(reception_id, good_no) );

insert into Goods VALUES(1, 'Mouse Logitech', 'High'); insert into Goods VALUES(2, 'E-book Kindle', 'High'); insert into Goods VALUES(3, 'Laptop Packard Bell', 'High'); insert into Receptions VALUES(1, #01.08.2013#); insert into Receptions VALUES(12, #04.08.2013#); insert into Receptions VALUES(13, #07.09.2013#); insert into ReceptionsMaterials VALUES(1, 2, 17, 225); insert into ReceptionsMaterials VALUES(1, 1, 25, 50); insert into ReceptionsMaterials VALUES(12, 3, 34, 399); insert into ReceptionsMaterials VALUES(13, 1, 10, 55); insert into ReceptionsMaterials VALUES(13, 2, 4, 195);

ALTER TABLE ReceptionsMaterials ADD COLUMN(VAT NUMBER); ALTER TABLE Goods DROP COLUMN quality;

UPDATE ReceptionsMaterials SET VAT=0,24; UPDATE Receptions SET reception_date=#22.11.2013# WHERE reception_id=1;

DELETE FROM ReceptionsMaterials [WHERE good_no=1];

ALTER TABLE ReceptionsMaterials DROP CONSTRAINT pk_reception_id_good_no; ALTER TABLE ReceptionsMaterials DROP CONSTRAINT fk_good_no; DROP TABLE Goods;

ALTER TABLE ReceptionsMaterials DROP CONSTRAINT fk_reception_id; DROP Table Receptions; DROP TABLE ReceptionsMaterials;

You might also like