About automatic creation of new column | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

About automatic creation of new column

Does the following statement create new column in table called SQRT(Salary) after calculating the average SELECT Salary, SQRT(Salary) FROM employees;

31st Mar 2020, 5:14 AM
Krishna Priyatham Potluri
Krishna Priyatham Potluri - avatar
3 Answers
+ 2
No buddy, SQRT here is a function that is used to calculate and return the square root of the given argument. The query selects 'Salary' column and square root of 'Salary' column from 'employees' table. It does not create new column in 'employees' table. Reference: https://www.w3resource.com/sql/arithmetic-functions/sqrt.php
31st Mar 2020, 8:04 AM
Ipang
+ 1
Ipang then where will the square root of salary column come from?
31st Mar 2020, 8:15 AM
Krishna Priyatham Potluri
Krishna Priyatham Potluri - avatar
0
Krishna Priyatham Potluri Value used to calculate square root come from the same table 'employees', and same column 'Salary'. Each record in the resultset will have two column; the value of 'Salary' column itself, and square root of 'Salary' column.
31st Mar 2020, 8:24 AM
Ipang