0 votes
in Oracle by

Find the error from the below SQL Query?

SELECT Name, YEAR(BirthDate) AS BirthYear
FROM StudentDetails
WHERE BirthYear >= 1998;

1 Answer

0 votes
by

Ans is 

This query will throw an error on the WHERE clause. Although an alias is specified in the SELECT clause it is not visible in the WHERE clause. The correct code can be written as follows:
SELECT Name, YEAR(BirthDate) AS BirthYear
FROM StudentDetails
WHERE YEAR(BirthDate) >= 1998;

Related questions

0 votes
asked Jul 29, 2020 in Oracle by Hodge
0 votes
0 votes
asked Jul 29, 2020 in Oracle by Hodge
+1 vote
asked May 13, 2020 in Oracle by AdilsonLima
...