#reset.sql

#createProductTable.sql
#Table structure for table as_Product
CREATE TABLE as_Product
(
  product_id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  name VARCHAR(40) NOT NULL,
  cat_code VARCHAR(3) NOT NULL,
  price DECIMAL(6,2) NOT NULL,
  quantity INT NOT NULL,
  image_file VARCHAR(30) NOT NULL
);

# loadProducts.sql
DELETE FROM as_Product;
LOAD DATA LOCAL INFILE '../Products.csv'
    INTO TABLE as_Product
    FIELDS TERMINATED BY ',';

#createOrderTable.sql
#Table structure for table as_Order
CREATE TABLE as_Order
(
  order_id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  customer_id INT NOT NULL,
  order_status VARCHAR(2) NOT NULL,
  date_time DATETIME NOT NULL
);

#createOrderItemTable.sql
#Table structure for table as_OrderItem
CREATE TABLE as_OrderItem
(
  order_item_id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  order_item_name VARCHAR(40) NOT NULL,
  order_item_status VARCHAR(2) NOT NULL,
  order_id INT NOT NULL,
  product_id INT NOT NULL,
  quantity INT NOT NULL,
  price DECIMAL(6,2) NOT NULL
);

