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

      1. <small id='Nc9xZ'></small><noframes id='Nc9xZ'>

        字段“id"没有默认值?

        Field #39;id#39; doesn#39;t have a default value?(字段“id没有默认值?)
        <tfoot id='7yqRv'></tfoot>

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

                  <small id='7yqRv'></small><noframes id='7yqRv'>

                  本文介绍了字段“id"没有默认值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我是这个 SQL 的新手;我在更大的程序中看到过类似的问题,目前我无法理解.我正在为我的主页中使用的纸牌游戏制作一个数据库.

                  I am new to this SQL; I have seen similar question with much bigger programs, which I can't understand at the moment. I am making a database for games of cards to use in my homepage.

                  我在 Windows 上使用 MySQL Workbench.我得到的错误是:

                  I am using MySQL Workbench on Windows. The error I get is:

                  错误代码:1364.字段id"没有默认值

                  Error Code: 1364. Field 'id' doesn't have a default value

                  CREATE TABLE card_games
                  (
                  nafnleiks varchar(50), 
                  leiklysing varchar(3000), 
                  prentadi varchar(1500), 
                  notkunarheimildir varchar(1000), 
                  upplysingar varchar(1000), 
                  ymislegt varchar(500), 
                  id int(11) PK
                  );
                  
                  insert into card_games (nafnleiks, leiklysing, prentadi, notkunarheimildir, upplysingar, ymislegt)
                  
                  values('Svartipétur',
                  'Leiklsingu vantar',
                  'Er prenta í: órarinn Gumundsson (2010). Spilabókin - Allir helstu spilaleikir og spil.',
                  'Heimildir um notkun: rni Sigursson (1951). Hátíir og skemmtanir fyrir hundra árum',
                  'Arar upplsingar',
                  'ekkert hér sem stendur'
                  );
                  
                  values('Handkurra',
                  'Leiklsingu vantar',
                  'Er prenta í: órarinn Gumundsson (2010). Spilabókin - Allir helstu spilaleikir og spil.',
                  'Heimildir um notkun', 
                  'Arar upplsingar',
                  'ekkert her sem stendur'
                  );
                  
                  values('Veiimaur',
                  'Leiklsingu vantar',
                  'órarinn Gumundsson (2010). Spilabókin - Allir helstu spilaleikir og spil. Reykjavík: Bókafélagi. Bls. 19-20.',
                  'vantar',
                  'vantar',
                  'vantar'
                  );
                  

                  推荐答案

                  由于 id 是主键,所以不同的行不能有相同的值.尝试更改您的表格,以便 id 自动递增:

                  As id is the primary key, you cannot have different rows with the same value. Try to change your table so that the id is auto incremented:

                  id int NOT NULL AUTO_INCREMENT
                  

                  然后设置主键如下:

                  PRIMARY KEY (id)
                  

                  一起:

                  CREATE TABLE card_games (
                     id int(11) NOT NULL AUTO_INCREMENT,
                     nafnleiks varchar(50),
                     leiklysing varchar(3000), 
                     prentadi varchar(1500), 
                     notkunarheimildir varchar(1000),
                     upplysingar varchar(1000),
                     ymislegt varchar(500),
                     PRIMARY KEY (id));
                  

                  否则,您可以在每次插入时指定id,注意每次设置不同的值:

                  Otherwise, you can indicate the id in every insertion, taking care to set a different value every time:

                  insert into card_games (id, nafnleiks, leiklysing, prentadi, notkunarheimildir, upplysingar, ymislegt)
                  
                  values(1, 'Svartipétur', 'Leiklsingu vantar', 'Er prenta í: órarinn Gumundsson (2010). Spilabókin - Allir helstu spilaleikir og spil.', 'Heimildir um notkun: rni Sigursson (1951). Hátíir og skemmtanir fyrir hundra árum', 'Arar upplsingar', 'ekkert hér sem stendur' );
                  

                  这篇关于字段“id"没有默认值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to delete duplicate records in mysql database?(如何删除mysql数据库中的重复记录?)
                  Python Pandas write to sql with NaN values(Python Pandas 使用 NaN 值写入 sql)
                  MySQL Insert amp; Joins(MySQL 插入 amp;加入)
                  MySQL concat() to create column names to be used in a query?(MySQL concat() 创建要在查询中使用的列名?)
                  NodeJS responded MySQL timezone is different when I fetch directly from MySQL(当我直接从 MySQL 获取时,NodeJS 响应 MySQL 时区不同)
                  WHERE datetime older than some time (eg. 15 minutes)(WHERE 日期时间早于某个时间(例如 15 分钟))

                    <bdo id='4ZsNE'></bdo><ul id='4ZsNE'></ul>
                    <tfoot id='4ZsNE'></tfoot>

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

                          • <legend id='4ZsNE'><style id='4ZsNE'><dir id='4ZsNE'><q id='4ZsNE'></q></dir></style></legend>

                            <small id='4ZsNE'></small><noframes id='4ZsNE'>