GATE | GATE 2017 MOCK II | Question 56

Using the EMPLOYEE table, the following query is issued to generate the name, salary and the salary increased after an appraisal by 25 %. The increased salary for all the employee should be above 25000.

SELECT fname, salary, salary + (salary *0.25) AS "INCREASED_SALARY" 
FROM employee 
WHERE increased_salary > 25000; 

The above query throws an error. What is the reason for the error ?
(A) The parenthesis is missing in the expression used in SELECT statement.
(B) Single quotes must be used to define a column alias.
(C) Column alias cannot be used in the WHERE clause.
(D) Column alias in the WHERE clause must be enclosed within double quotation marks.


Answer: (C)

Explanation: A column alias cannot be used in WHERE clause conditions but can be used in SELECT statement and ORDER BY clause.


Quiz of this Question



My Personal Notes arrow_drop_up


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.