Skip to content

Commit

Permalink
add ddl
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Oct 6, 2023
1 parent 99a4464 commit 37153eb
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public String toInput(Map<String, Object> map,Course course) {
course.setCourseStatus("O");
course.setCourseReqs(new String[]{"a","b"});

log.info("new course = " + course);
map.put("course", course);

return "course/input_course";
Expand Down
20 changes: 20 additions & 0 deletions springWarehouse/sql/ddl/product.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- DDL for product (mysql)
-- DB : warehouse_system

-- create database warehouse_system;

CREATE TABLE IF NOT EXISTS product(
id int PRIMARY KEY AUTO_INCREMENT,
name varchar(100) not null,
type_id int not null,
price int not null,
product_status varchar(1) not null,
constraint FK_PRODUCT_TYPE FOREIGN KEY (type_id) references product_type(type_id)
);

-- DML
INSERT INTO product(name, type_id, price, product_status)
VALUES
("i-phone", 2, 300, "0"),
("cookie", 4, 10, "0"),
("soap", 1, 50, "0");
18 changes: 18 additions & 0 deletions springWarehouse/sql/ddl/product_type.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- DDL for product_type (mysql)
-- DB : warehouse_system

-- create database warehouse_system;

CREATE TABLE IF NOT EXISTS product_type(

type_id int PRIMARY KEY AUTO_INCREMENT,
type_name varchar(30) not null
);

-- DML
INSERT INTO product_type(type_name)
values
("fmcg"),
("mobile"),
("hardware"),
("food");

0 comments on commit 37153eb

Please sign in to comment.