0

I want to count the number of employees

SQL> select count(ename) AS number 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>

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Or using double quotes: as "Number Of People"
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.