我正在尝试让我的代码工作,只是从我插入的第一行我得到一个错误。我已经将电话号码的值更改为varchar,但此错误仍然存在。
这是我的代码:
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8 ;
USE `mydb` ;
CREATE TABLE IF NOT EXISTS `mydb`.`Customer` (
`Customer_ID` INT NOT NULL,
`Customer_F_Name` VARCHAR(45) NOT NULL,
`Customer_L_Name` VARCHAR(45) NOT NULL,
`Customer_Address` VARCHAR(45) NOT NULL,
`Customer_DOB` DATE NOT NULL,
`Customer_H_Phone` VARCHAR(20) NOT NULL,
`Customer_W_Phone` VARCHAR(20) NOT NULL,
`Customer_Type` VARCHAR(45) NOT NULL,
`Customer_Sponsor_ID` INT NULL,
PRIMARY KEY (`Customer_ID`),
INDEX `fk_Customer_Customer1_idx` (`Customer_Sponsor_ID` ASC),
CONSTRAINT `fk_Customer_Customer1`
FOREIGN KEY (`Customer_Sponsor_ID`)
REFERENCES `mydb`.`Customer` (`Customer_ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
INSERT INTO `Customer` (`Customer_ID`, `Customer_F_Name`, `Customer_L_Name`,
`Customer_Address`, `Customer_DOB`, `Customer_H_Phone`, `Customer_W_Phone`,
`Customer_Type`, `Customer_Sponsor_ID`) VALUES
(1, 'Nicole', 'Gilbert', '8295 Golden Leaf Alley',
'1992-03-28', '5744813109', '1646648129', 'Student', NULL);
然后当我插入第一行数据时,这就是我得到的错误:
INSERT INTO `Customer` (`Customer_ID`, `Customer_F_Name`, `Customer_L_Name`,
`Customer_Address`, `Customer_DOB`, `Customer_H_Phone`, `Customer_W_Phone`,
`Customer_Type`, `Customer_Sponsor_ID`) VALUES
(1, 'Nicole', 'Gilbert', '8295 Golden Leaf Alley',
'1992-03-28', '5744813109', '1646648129', 'Student', NULL)
Error Code: 1264. Out of range value for column
'Customer_H_Phone' at row 1
谢谢!