1

Why can't I give an alias to a table in Oracle DB? I tried to write a statement like this one:

select count(id) from users as usr where usr.dept = "SVC";

But Oracle threw me an error. I don't remember having problem when I use something like this in MySQL.

How can I give an alias to a table in Oracle?

Carven
  • 14,988
  • 29
  • 118
  • 161

1 Answers1

5

Oracle doesn't allow as for table aliases, only column aliases. So do:

select count(id)
from users usr
where usr.dept = 'SVC';
Maheswaran Ravisankar
  • 17,652
  • 6
  • 47
  • 69
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786