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

  • <tfoot id='Oxr95'></tfoot>
    1. <legend id='Oxr95'><style id='Oxr95'><dir id='Oxr95'><q id='Oxr95'></q></dir></style></legend>

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

      1. 获取 MySQL 中现有行的插入语句

        时间:2024-04-15

            1. <tfoot id='y2TMY'></tfoot>

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

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

                <bdo id='y2TMY'></bdo><ul id='y2TMY'></ul>
                  <tbody id='y2TMY'></tbody>
              • <legend id='y2TMY'><style id='y2TMY'><dir id='y2TMY'><q id='y2TMY'></q></dir></style></legend>

                  本文介绍了获取 MySQL 中现有行的插入语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  使用 MySQL 我可以运行查询:

                  Using MySQL I can run the query:

                  SHOW CREATE TABLE MyTable;
                  

                  它会返回指定表的创建表语句.如果您已经创建了一个表,并且想要在另一个数据库上创建相同的表,这将非常有用.

                  And it will return the create table statement for the specificed table. This is useful if you have a table already created, and want to create the same table on another database.

                  是否可以为已经存在的行或一组行获取插入语句?有些表有很多列,如果我能够得到一个插入语句来将行传输到另一个数据库而不必写出插入语句,或者不必将数据导出到 CSV 然后导入相同的数据,那对我来说会很好进入另一个数据库.

                  Is it possible to get the insert statement for an already existing row, or set of rows? Some tables have many columns, and it would be nice for me to be able to get an insert statement to transfer rows over to another database without having to write out the insert statement, or without exporting the data to CSV and then importing the same data into the other database.

                  只是澄清一下,我想要的是如下工作方式:

                  Just to clarify, what I want is something that would work as follows:

                  SHOW INSERT Select * FROM MyTable WHERE ID = 10;
                  

                  并为我返回以下内容:

                  INSERT INTO MyTable(ID,Col1,Col2,Col3) VALUES (10,'hello world','some value','2010-10-20');
                  

                  推荐答案

                  似乎没有办法从 MySQL 控制台获取 INSERT 语句,但您可以使用 mysqldump 就像 Rob 建议的那样.指定 -t 以省略表创建.

                  There doesn't seem to be a way to get the INSERT statements from the MySQL console, but you can get them using mysqldump like Rob suggested. Specify -t to omit table creation.

                  mysqldump -t -u MyUserName -pMyPassword MyDatabase MyTable --where="ID = 10"
                  

                  这篇关于获取 MySQL 中现有行的插入语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Django - 向 MySQL 数据库添加行 下一篇:“订购者"使用列名参数

                  相关文章

                  • <bdo id='F071L'></bdo><ul id='F071L'></ul>

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

                    2. <tfoot id='F071L'></tfoot>
                      <legend id='F071L'><style id='F071L'><dir id='F071L'><q id='F071L'></q></dir></style></legend>

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