The task is as follows: print a SELECT column with a sum and after it the whole table again. How to do it?

I try the following code:

 SELECT salary*(1+commission_pct) as "sum", * FROM EMPLOYEES WHERE not commission_pct is null ORDER BY "sum" 

Error SQL Error while processing results: ORA-00936: missing expression

The salary and commission_pct columns in EMPLOYEES are present.

  • And you accidentally limit the names of the columns do not need apostrophes, not double quotes !? - Visman
  • Are you sure that the condition of the form WHERE NOT <столбец> IS NULL is a valid syntax? I am not familiar with the PL / SQL dialect, but vague doubts on this account are somehow plagued. - Yaant
  • Not sure maybe. However, the following is such a thing: SELECT salary*(1+commission_pct) as 'sum' FROM EMPLOYEES WHERE not commission_pct is null ORDER BY 'sum'
  • With where all the rules, this is a valid syntax. - hunter
  • one
    And yet, purely to clear your conscience, try to write it in the appropriate standard (and documentation ) as follows: WHERE <столбец> IS NOT NULL - Yaant

1 answer 1

So write:

 SELECT salary*(1+commission_pct) as "sum", EMPLOYEES.* FROM EMPLOYEES WHERE not commission_pct is null ORDER BY "sum"