What is the SQL to define DEFAULT
values in MySQL?
在MySQL中定义默认值的SQL是什么?
In the code below what needs to be added / changed to give IsObsolete a default value of N
?
在下面的代码中,需要添加/修改什么才能使is废旧值为N?
CREATE TABLE Team
(
TeamId CHAR(16) NOT NULL,
DateCreated TIMESTAMP NOT NULL,
IsObsolete CHAR(1) NOT NULL DEFAULT N,
UpdateTime TIMESTAMP NOT NULL
);
3 个解决方案
#1
13
IsObsolete CHAR(1) NOT NULL DEFAULT 'N'
#2
7
You probably want to put quotes around it:
你可能想在上面加上引号
CREATE TABLE Team
(
TeamId CHAR(16) NOT NULL,
DateCreated TIMESTAMP NOT NULL,
IsObsolete CHAR(1) NOT NULL DEFAULT 'N',
UpdateTime TIMESTAMP NOT NULL
);
#3
1
If your are changing your structure via phpMyAdmin, you should just type in the char (e.g N) as opposed to 'N'
如果您正在通过phpMyAdmin修改结构,那么只需输入char (e)。g N)而不是N
#1
13
IsObsolete CHAR(1) NOT NULL DEFAULT 'N'
#2
7
You probably want to put quotes around it:
你可能想在上面加上引号
CREATE TABLE Team
(
TeamId CHAR(16) NOT NULL,
DateCreated TIMESTAMP NOT NULL,
IsObsolete CHAR(1) NOT NULL DEFAULT 'N',
UpdateTime TIMESTAMP NOT NULL
);
#3
1
If your are changing your structure via phpMyAdmin, you should just type in the char (e.g N) as opposed to 'N'
如果您正在通过phpMyAdmin修改结构,那么只需输入char (e)。g N)而不是N