简体   繁体   中英

Adding a new empty column to sql select query

i have the following sql select query

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

你可以这样做

select column1,column2,1 as column3 from mytable

w3 Schools has a good section on this SQL Alter Table Statement .

The specific command would 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM