i have the following sql select query
我有以下sql选择查询
select column1,column2 from mytable
is a way to add an empty column to the query that doesnt exist in the table such as
是一种向表中不存在的查询添加空列的方法,例如
select column1,column2,empty int column from mytable
2 个解决方案
#1
4
You can do this like that
你可以这样做
select column1,column2,1 as column3 from mytable
#2
-1
w3 Schools has a good section on this SQL Alter Table Statement.
w3 Schools在这个SQL Alter Table语句中有一个很好的部分。
The specific command would ALTER TABLE table_name ADD column_name datatype
具体命令为ALTER TABLE table_name ADD column_name datatype
While it does not add the column in a select statement I believe this will accomplish what you are looking for.
虽然它没有在select语句中添加列,但我相信这将完成您正在寻找的内容。
#1
4
You can do this like that
你可以这样做
select column1,column2,1 as column3 from mytable
#2
-1
w3 Schools has a good section on this SQL Alter Table Statement.
w3 Schools在这个SQL Alter Table语句中有一个很好的部分。
The specific command would ALTER TABLE table_name ADD column_name datatype
具体命令为ALTER TABLE table_name ADD column_name datatype
While it does not add the column in a select statement I believe this will accomplish what you are looking for.
虽然它没有在select语句中添加列,但我相信这将完成您正在寻找的内容。