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

    <tfoot id='MZXW6'></tfoot>

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

      1. 在字段名称周围使用反引号

        时间:2023-08-18

        <small id='6R3QD'></small><noframes id='6R3QD'>

        <tfoot id='6R3QD'></tfoot>

          <bdo id='6R3QD'></bdo><ul id='6R3QD'></ul>

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

                  <tbody id='6R3QD'></tbody>
                  <legend id='6R3QD'><style id='6R3QD'><dir id='6R3QD'><q id='6R3QD'></q></dir></style></legend>

                  本文介绍了在字段名称周围使用反引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在这里阅读了一些关于 SQL 问题的答案和评论后,还听说我的一个朋友在一个有禁止它们的政策的地方工作,我想知道在 field 周围使用反引号是否有什么问题MySQL 中的名称.

                  After reading a couple of answers and comments on some SQL questions here, and also hearing that a friend of mine works at a place which has a policy which bans them, I'm wondering if there's anything wrong with using backticks around field names in MySQL.

                  即:

                  SELECT `id`, `name`, `anotherfield` ...
                  -- vs --
                  SELECT id, name, anotherfield ...
                  

                  推荐答案

                  使用反引号允许您使用替代字符.在查询编写中,这不是一个问题,但是如果有人假设您可以只使用反引号,我认为它可以让您摆脱诸如

                  Using backticks permits you to use alternative characters. In query writing it's not such a problem, but if one assumes you can just use backticks, I would assume it lets you get away with ridiculous stuff like

                  SELECT `id`, `my name`, `another field` , `field,with,comma` 
                  

                  这当然会生成名称错误的表.

                  Which does of course generate badly named tables.

                  如果你只是简明扼要,我看不出有什么问题,你会注意到你是否这样运行你的查询

                  If you're just being concise I don't see a problem with it, you'll note if you run your query as such

                  EXPLAIN EXTENDED Select foo,bar,baz 
                  

                  返回的生成警告将带有反引号完全限定的表名.因此,如果您正在使用查询生成功能和自动重写查询,反引号将使解析代码的任何内容变得不那么混乱.

                  The generated warning that comes back will have back-ticks and fully qualified table names. So if you're using query generation features and automated re-writing of queries, backticks would make anything parsing your code less confused.

                  然而,我认为,与其强制您是否可以使用反引号,不如他们应该有一个名称标准.它解决了更多真实"的问题.

                  I think however, instead of mandating whether or not you can use backticks, they should have a standard for names. It solves more 'real' problems.

                  这篇关于在字段名称周围使用反引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:MySQL:@variable 与变量.有什么不同? 下一篇:如何选择每个类别的最新四个项目?

                  相关文章

                  最新文章

                        <bdo id='9dbns'></bdo><ul id='9dbns'></ul>

                      <small id='9dbns'></small><noframes id='9dbns'>

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