问题描述
- A mysql problem. Help me!
-
why these statements are wrong ?
these statements are auto generated by mysql workbench-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- Schema SysBaseData
-- Schema SysBaseData
CREATE SCHEMA IF NOT EXISTSSysBaseData
DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
SHOW WARNINGS;
USESysBaseData
;
-- TableSysBaseData
.Instruments
CREATE TABLE IF NOT EXISTSSysBaseData
.Instruments
(InstrumentID
CHAR(32) NOT NULL,ExchangeID
CHAR(12) NOT NULL,InstrumentName
CHAR(24) NULL,
PRIMARY KEY (InstrumentID
,ExchangeID
))
ENGINE = InnoDB;SHOW WARNINGS;
-- TableSysBaseData
.OrdersGroups
CREATE TABLE IF NOT EXISTSSysBaseData
.OrdersGroups
(OrderGroup
INT NOT NULL,OrderRef
CHAR(16) NOT NULL,TradingDay
DATE NOT NULL,
PRIMARY KEY (OrderRef
,TradingDay
,OrderGroup
))
ENGINE = InnoDB;SHOW WARNINGS;
-- TableSysBaseData
.ErrorOrderRecords
CREATE TABLE IF NOT EXISTSSysBaseData
.ErrorOrderRecords
(InstrumentID
CHAR(32) NULL,ExchangeID
CHAR(12) NULL,OrderPriceType
CHAR NULL,Direction
CHAR NULL,LimitPrice
CHAR(16) NULL,VolumeTotalOriginal
INT NULL,ErrorMsg
CHAR(255) NULL,OrderGroup
INT NOT NULL,OrderRef
CHAR(16) NOT NULL,TradingDay
DATE NOT NULL,
PRIMARY KEY (TradingDay
,OrderRef
,OrderGroup
),
CONSTRAINTfk_ErrorOrderRecords_1
FOREIGN KEY (TradingDay
,OrderRef
,OrderGroup
)
REFERENCESSysBaseData
.OrdersGroups
(TradingDay
,OrderRef
,OrderGroup
)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;SHOW WARNINGS;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
解决方案
眼拙,没看出来错在哪。
时间: 2024-11-10 00:23:53