Home > database >  The novice inquired about the basis of a select statement
The novice inquired about the basis of a select statement

Time:10-11

Watching a tutorial, when it comes to query a database salary higher than the average case, given the current method is nested sub-queries, teacher speak why where there cannot be directly with avg, so now gave the solution to a nested
Want to ask, why not behind the select, directly on the field for more than logic operation? Test is not enough, but I don't know why

CodePudding user response:

For example,
Query above average wages, why can't write
Select ename, sal & gt; Avg (sal) from XXXX

CodePudding user response:

Sal & gt; Avg (sal) belongs to the condition condition, should be placed behind the where;
Select standard syntax format select * from table where conditon
Select only can back with columns, column calculation, the aggregation function, assignment statements;

  • Related