0

[SOLVED] Is this valid if valid tell reason ?

Select 'total sal' sal+commission from emp;

7th Feb 2020, 2:56 PM
Akhilesh Chandra
Akhilesh Chandra - avatar
4 Respuestas
+ 1
/ As my experience it's invalid ,You can use this Select sal, commission from emp;
7th Feb 2020, 3:06 PM
Sudarshan Rai
Sudarshan Rai - avatar
0
Can you please take care that your code example is properly formatted? Also tell us the language. And tags are meant as keywords to look up your question. Putting your name there doesn't make sense.
7th Feb 2020, 3:05 PM
HonFu
HonFu - avatar
0
Language is SQL
7th Feb 2020, 3:07 PM
Akhilesh Chandra
Akhilesh Chandra - avatar
0
You can include a column name inside quotes so that is fine but there shouldn't be space in between them. And as long as sal and commision are numerical values then they should work as well. It should return the sum of each record. It would be better if you use- Select sal+commission AS totalSal from emp; It just enhances readability.
7th Feb 2020, 3:16 PM
Avinesh
Avinesh - avatar