gpt4 book ai didi

mysql - 如何使用自动递增的列(字段)将数据插入 MySQL?

转载 作者:IT老高 更新时间:2023-10-28 12:53:32 28 4
gpt4 key购买 nike

我创建了一个带有主键的表并启用了AUTO_INCREMENT:

CREATE TABLE IF NOT EXISTS test.authors (
hostcheck_id INT PRIMARY KEY AUTO_INCREMENT,
instance_id INT,
host_object_id INT,
check_type INT,
is_raw_check INT,
current_check_attempt INT,
max_check_attempts INT,
state INT,
state_type INT,
start_time datetime,
start_time_usec INT,
end_time datetime,
end_time_usec INT,
command_object_id INT,
command_args VARCHAR(25),
command_line VARCHAR(100),
timeout int,
early_timeout INT,
execution_time DEC(18,5),
latency DEC(18,3),
return_code INT,
output VARCHAR(50),
long_output VARCHAR(50),
perfdata VARCHAR(50)
);

然后,通过下面的查询,我尝试了 ""和 "1"作为第一个值,但它不起作用:

INSERT INTO  test.authors VALUES ('1','1','67','0','0','1','10','0','1',
'2012-01-03 12:50:49','108929','2012-01-03 12:50:59','198963','21','',
'/usr/local/nagios/libexec/check_ping 5','30','0','4.04159','0.102','1',
'PING WARNING -DUPLICATES FOUND! Packet loss = 0%, RTA = 2.86 ms','',
'rta=2.860000m=0%;80;100;0');

那么,如何将数据插入到 MySQL 自增列(字段)?

最佳答案

如果您希望自动神奇地分配自动增量字段,请将其设置为 NULL 或 0...

关于mysql - 如何使用自动递增的列(字段)将数据插入 MySQL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8753371/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com