What will be the output of Following SQL Query

Question

What will be the output of following sql query
SELECT     name,
        last_name,
        salary
FROM Salary
WHERE salary >    (SELECT AVG (salary)
                    FROM Salary);

in progress 0
Prathmesh 55 years 1 Answer 992 views Newbie 0

Answer ( 1 )

  1. After Running the code will return the columns name, last_name, and salary from the table Salary, but only where the salary is greater than the average number of salary from Salary Table.

  2. The inner query executes first.
    Therefore it will first compute average of salary among the salaries in the salary table and then select the salaries that are greater than the value of avg(salary).
    Then these selected tuples will return to the above query where their name,last_name and salary will be printed for the people whose salaries is greater than avg(salary) which is returned by inner query.

    0

    It will return only those salaries which are greater than the average salary .

Leave an answer

Browse
Browse