mysql-从给定列号的表中选择值 [英] mysql - selecting values from a table given column number
问题描述
在mysql中是否可以通过指定列号而不是列名来从表中选择一个值?
is it possible in mysql to select a value from a table by specifying the column number instead of the column name ?
推荐答案
否,您不能在SELECT子句中使用列的序数值.
No, you can not use the ordinal value of a column in the SELECT clause.
列顺序与数据库无关;顺序值基于SELECT子句中的列列表.在 SELECT子句之后支持顺序值-IE:GROUP BY
和ORDER BY
中的IE :.就是说,不建议使用序号,因为序号很脆弱-如果有人更改SELECT子句中的列顺序,则会对查询产生负面影响.
Column order is irrelevant to a database; the ordinal value is based on the list of columns in the SELECT clause. The ordinal value is supported after the SELECT clause - IE: in the GROUP BY
, and ORDER BY
. That said, using ordinals is not a recommended approach because ordinals are brittle -- if someone changes the column order in the SELECT clause, the query can be negatively impacted.
这篇关于mysql-从给定列号的表中选择值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!