What's wrong with this command in SQL plus?
I want to count the number of employees
SQL> select count(ename) AS num开发者_开发问答ber of people, from emp;
select count(ename) AS number of people, from emp
*
ERROR at line 1:
ORA-00923: FROM keyword not found where expected
SQL>
Here's my table
SQL> select ename from emp;
ENAME
----------
KING
BLAKE
CLARK
JONES
MARTIN
ALLEN
TURNER
JAMES
WARD
FORD
SMITH
ENAME
----------
SCOTT
ADAMS
MILLER
14 rows selected.
SQL>
The comma after the "people" is probably what's causing the error.
You will also need to use a different alias for the count() column, either by removing the spaces or replacing them with underscores.
Remove the comma before the FROM clause. Also, you can't have spaces in field name, use underscores instead.
Also, it's good practice to capitalise keywords:
SELECT COUNT(ename) AS number_of_people FROM emp
精彩评论