mysql-从给定列号的表中选择值 [英] mysql - selecting values from a table given column number

查看:106
本文介绍了mysql-从给定列号的表中选择值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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 BYORDER 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆