Home | Previous Page | Next Page   Appendix B. Demonstration SQL > SQL Files for the Relational Database Model >

c_items.sql

The following command file creates the items table:

CREATE TABLE items
   (
   item_num          SMALLINT,
   order_num         INTEGER,
   stock_num         SMALLINT NOT NULL,
   manu_code         CHAR(3) NOT NULL,
   quantity          SMALLINT CHECK (quantity >= 1),
   total_price       MONEY(8),
   PRIMARY KEY (item_num, order_num),
   FOREIGN KEY (order_num) REFERENCES orders (order_num),
   FOREIGN KEY (stock_num, manu_code) REFERENCES stock
      (stock_num, manu_code)
   );
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]