<small id='fDeCG'></small><noframes id='fDeCG'>

        <i id='fDeCG'><tr id='fDeCG'><dt id='fDeCG'><q id='fDeCG'><span id='fDeCG'><b id='fDeCG'><form id='fDeCG'><ins id='fDeCG'></ins><ul id='fDeCG'></ul><sub id='fDeCG'></sub></form><legend id='fDeCG'></legend><bdo id='fDeCG'><pre id='fDeCG'><center id='fDeCG'></center></pre></bdo></b><th id='fDeCG'></th></span></q></dt></tr></i><div id='fDeCG'><tfoot id='fDeCG'></tfoot><dl id='fDeCG'><fieldset id='fDeCG'></fieldset></dl></div>
      1. <legend id='fDeCG'><style id='fDeCG'><dir id='fDeCG'><q id='fDeCG'></q></dir></style></legend>

          <bdo id='fDeCG'></bdo><ul id='fDeCG'></ul>
        <tfoot id='fDeCG'></tfoot>

        如何将数据插入具有自动递增主键的 MySQL?

        时间:2023-06-25

          <bdo id='GiJ19'></bdo><ul id='GiJ19'></ul>

            <small id='GiJ19'></small><noframes id='GiJ19'>

              <i id='GiJ19'><tr id='GiJ19'><dt id='GiJ19'><q id='GiJ19'><span id='GiJ19'><b id='GiJ19'><form id='GiJ19'><ins id='GiJ19'></ins><ul id='GiJ19'></ul><sub id='GiJ19'></sub></form><legend id='GiJ19'></legend><bdo id='GiJ19'><pre id='GiJ19'><center id='GiJ19'></center></pre></bdo></b><th id='GiJ19'></th></span></q></dt></tr></i><div id='GiJ19'><tfoot id='GiJ19'></tfoot><dl id='GiJ19'><fieldset id='GiJ19'></fieldset></dl></div>
            1. <tfoot id='GiJ19'></tfoot>
                  <tbody id='GiJ19'></tbody>

                <legend id='GiJ19'><style id='GiJ19'><dir id='GiJ19'><q id='GiJ19'></q></dir></style></legend>
                • 本文介绍了如何将数据插入具有自动递增主键的 MySQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我已经创建了一个带有主键的表并启用了 AUTO_INCREMENT,我如何让 MYSQL 使用 AUTO_INCREMENT?

                  I've created a table with a primary key and enabled AUTO_INCREMENT, how do I get MYSQL use 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" 作为第一个值,但它不起作用.

                  Here is the query I used, I've tried "" and "1" for the first value but it doesn't work.

                  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'); 
                  

                  推荐答案

                  为了利用列的自动递增功能,插入行时不要为该列提供值.数据库将为您提供一个值.

                  In order to take advantage of the auto-incrementing capability of the column, do not supply a value for that column when inserting rows. The database will supply a value for you.

                  INSERT INTO test.authors (
                     instance_id,host_object_id,check_type,is_raw_check,
                     current_check_attempt,max_check_attempts,state,state_type,
                     start_time,start_time_usec,end_time,end_time_usec,command_object_id,
                     command_args,command_line,timeout,early_timeout,execution_time,
                     latency,return_code,output,long_output,perfdata
                  ) VALUES (
                     '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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:哪些 MySQL 驱动程序可用于 node.js? 下一篇:Django - 安装 mysqlclient 错误:需要 mysqlclient 1.3.13 或更新版本;你有 0.

                  相关文章

                    <i id='KSQ1w'><tr id='KSQ1w'><dt id='KSQ1w'><q id='KSQ1w'><span id='KSQ1w'><b id='KSQ1w'><form id='KSQ1w'><ins id='KSQ1w'></ins><ul id='KSQ1w'></ul><sub id='KSQ1w'></sub></form><legend id='KSQ1w'></legend><bdo id='KSQ1w'><pre id='KSQ1w'><center id='KSQ1w'></center></pre></bdo></b><th id='KSQ1w'></th></span></q></dt></tr></i><div id='KSQ1w'><tfoot id='KSQ1w'></tfoot><dl id='KSQ1w'><fieldset id='KSQ1w'></fieldset></dl></div>
                    <legend id='KSQ1w'><style id='KSQ1w'><dir id='KSQ1w'><q id='KSQ1w'></q></dir></style></legend><tfoot id='KSQ1w'></tfoot>
                    • <bdo id='KSQ1w'></bdo><ul id='KSQ1w'></ul>

                      <small id='KSQ1w'></small><noframes id='KSQ1w'>