sql >> Database >  >> RDS >> Oracle

Alias ​​gebruiken in query, waardoor de opdracht niet correct is beëindigd

Oracle ondersteunt geen tabelalias met de as .

Bijvoorbeeld:

SQL> select 1
  2  from dual as a;
from dual as a
             *
ERROR at line 2:
ORA-00933: SQL command not properly ended


SQL> select 1
  2  from dual a;

         1
----------
         1

Op dezelfde manier:

SQL> select *
  2  from (
  3        select 1 from dual
  4       ) as a;
     ) as a
          *
ERROR at line 4:
ORA-00933: SQL command not properly ended


SQL> select *
  2  from (
  3        select 1 from dual
  4       )  a;

         1
----------
         1

Kolomalias kan zowel met als zonder de as . zijn :

SQL> select 1 as one, 2 two
  2  from dual;

       ONE        TWO
---------- ----------
         1          2



  1. runtime-fout:java.lang.ClassNotFoundException:com.mysql.jdbc.Driver

  2. update gegevens in de div

  3. Nadelen van een tabel met te veel kolommen

  4. Records tellen uit twee tabellen gegroepeerd op één veld