1
對於下面的SQL我得到的錯誤:數據截斷誤差
Data truncation occurred on a write of column 0Data was 0 bytes long and 0 bytes were transferred.
代碼:
CREATE TABLE faculty_members
(
fid INTEGER AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(30) NOT NULL,
last_name VARCHAR(30) NOT NULL,
rank VARCHAR(25) NOT NULL,
office CHAR(8),
phone CHAR(12),
dob DATE NOT NULL,
salary DECIMAL(8,2),
CONSTRAINT faculty_members_pk PRIMARY KEY(fid),
CONSTRAINT faculty_members_ck UNIQUE(first_name,last_name,dob),
CONSTRAINT valid_salary CHECK(salary > 0)
);
而且這些都是INSERT語句
INSERT INTO faculty_members(first_name,last_name,rank,office,phone,dob,salary) VALUES
('Charles', 'Xavier', 'Professor', 'HSC 641', '563-555-6020', '11/09/1942', 125000),
('Bruce', 'Banner', 'Associate Professor', 'FO1 120', '563-555-8212', '06/20/1969', 87000),
('Hank', 'McCoy', 'Professor', 'FO1 120', '563-555-8212', '06/20/1972', 95000),
('Jeane', 'Grey', 'Assistant Professor', 'ECS 547', '563-555-8239', '03/19/1975', 95000),
('Erik', 'Lehnsherr', 'Professor', 'HSC 641', '563-555-6020', '11/09/1940', 115000),
('Diana', 'Prince', 'Associate Professor', 'HSC 400', '563-555-8212', '07/28/1967', 105100),
('Logan', 'Wolverine', 'Assistant Professor', 'ECS 540', '563-555-8100', '02/27/1964', 82000),
('Ororo', 'Storm', 'Assistant Professor', 'ECS 540', '563-555-8101', '05/01/1973', 82500);
+1好點。我看到的完整錯誤是:*數據截斷:錯誤日期值:'11/09/1942'列'dob'在第1行*「。 – eggyal
謝謝Marc。 @eggyal你在使用什麼程序,我正在使用SQuirrel SQL clent,而我得到的錯誤並不像你得到的那樣詳細。 – user1766104
@ user1766104:我剛剛嘗試http://sqlfiddle.com。儘管如此,可能會下降到服務器版本。 – eggyal