mysql实现黑马整合ssm案例Oracle数据库的建表工作

CREATE TABLE product (
  id VARCHAR (32) PRIMARY KEY,
  productNum VARCHAR (50) NOT NULL,
  productName VARCHAR (50),
  cityName VARCHAR (50),
  DepartureTime TIMESTAMP,
  productPrice DOUBLE,
  productDesc VARCHAR (500),
  productStatus INT,
  CONSTRAINT product UNIQUE (id, productNum)
) 
DELIMITER || 
CREATE TRIGGER `product_before_insert` BEFORE INSERT 
ON `product` FOR EACH ROW 
BEGIN
  IF new.id IS NULL 
  THEN SET new.id = REPLACE(UUID(), "-", "") ;
  END IF ;
  
END ;||
INSERT INTO product (
  id,
  productNum,
  productName,
  cityName,
  DepartureTime,
  productPrice,
  productDesc,
  productStatus
) 
VALUES
  (
    '676C5BD1D35E429A8C2E114939C5685A',
    'itcast-002',
    '北京三日游',
    '北京',
      '2018-10-10 10:10:00.000000',
    1200,
    '不错的旅行',
    1
  ) ;

INSERT INTO PRODUCT (
  id,
  productnum,
  productname,
  cityname,
  departuretime,
  productprice,
  productdesc,
  productstatus
) 
VALUES
  (
    '12B7ABF2A4C544568B0A7C69F36BF8B7',
    'itcast-003',
    '上海五日游',
    '上海',
      '2018-04-25 14:30:00.000000',
    1800,
    '魔都我来了',
    0
  ) ;

INSERT INTO PRODUCT (
  id,
  productnum,
  productname,
  cityname,
  departuretime,
  productprice,
  productdesc,
  productstatus
) 
VALUES
  (
    '9F71F01CB448476DAFB309AA6DF9497F',
    'itcast-001',
    '北京三日游',
    '北京',
      '2018-10-10 10:10:00.000000',
    1200,
    '不错的旅行',
    1
  ) ;

仅供参考

posted @ 2022-02-27 16:39  咸鱼划水  阅读(47)  评论(0编辑  收藏  举报