简体   繁体   中英

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

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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM