I have this mysql query :
Select name from my_table
This query return me this result :
NAME
-------
name1
name2
name3
How can I create a virtual column and set a defaut value in this column ? I want this result :
NAME | Virtual Column
------------------------
name1 | defaut_value
name2 | defaut_value
name3 | defaut_value
Like this:
SELECT name, 'default_value' AS "A Virtual Column"
FROM my_table
This is legal this way, because in the SELECT
clause you can select what so called, in the SQL standard, a value expression. Where value expression can be either of the following1:
1: This image from: SQL Queries for Mere Mortals(R): A Hands-On Guide to Data Manipulation in SQL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With