<bdo id='zwPcp'></bdo><ul id='zwPcp'></ul>
        <i id='zwPcp'><tr id='zwPcp'><dt id='zwPcp'><q id='zwPcp'><span id='zwPcp'><b id='zwPcp'><form id='zwPcp'><ins id='zwPcp'></ins><ul id='zwPcp'></ul><sub id='zwPcp'></sub></form><legend id='zwPcp'></legend><bdo id='zwPcp'><pre id='zwPcp'><center id='zwPcp'></center></pre></bdo></b><th id='zwPcp'></th></span></q></dt></tr></i><div id='zwPcp'><tfoot id='zwPcp'></tfoot><dl id='zwPcp'><fieldset id='zwPcp'></fieldset></dl></div>

      1. <legend id='zwPcp'><style id='zwPcp'><dir id='zwPcp'><q id='zwPcp'></q></dir></style></legend>
        <tfoot id='zwPcp'></tfoot>

        <small id='zwPcp'></small><noframes id='zwPcp'>

        如何使用“as"关键字为 Oracle 中的表设置别名?

        时间:2023-09-20

            <tbody id='PVWjS'></tbody>
            <bdo id='PVWjS'></bdo><ul id='PVWjS'></ul>
              <legend id='PVWjS'><style id='PVWjS'><dir id='PVWjS'><q id='PVWjS'></q></dir></style></legend>

              <small id='PVWjS'></small><noframes id='PVWjS'>

                <tfoot id='PVWjS'></tfoot>

                <i id='PVWjS'><tr id='PVWjS'><dt id='PVWjS'><q id='PVWjS'><span id='PVWjS'><b id='PVWjS'><form id='PVWjS'><ins id='PVWjS'></ins><ul id='PVWjS'></ul><sub id='PVWjS'></sub></form><legend id='PVWjS'></legend><bdo id='PVWjS'><pre id='PVWjS'><center id='PVWjS'></center></pre></bdo></b><th id='PVWjS'></th></span></q></dt></tr></i><div id='PVWjS'><tfoot id='PVWjS'></tfoot><dl id='PVWjS'><fieldset id='PVWjS'></fieldset></dl></div>

                  本文介绍了如何使用“as"关键字为 Oracle 中的表设置别名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试在 Oracle SQL Developer 中执行此查询:

                  I'm trying to execute this query in Oracle SQL Developer:

                  SELECT G.Guest_ID, G.First_Name, G.Last_Name
                  FROM Guest AS G
                    JOIN Stay AS S ON G.Guest_ID = S.Guest_ID
                  WHERE G.City = 'Miami' AND S.Room = '222';
                  

                  但是,我收到以下错误:

                  However, I get the following error:

                  ORA-00933: SQL command not properly ended
                  00933. 00000 - "SQL command not properly ended"
                  *Cause:
                  *Action:
                  Error at Line: 2 Column: 12
                  

                  我在第 2 行中没有看到任何问题,而且该错误的描述性不强.它似乎与 as 关键字有关.如果我删除它,它工作正常.但是,我希望我的查询非常详细.因此,我必须想办法在不删除 as 关键字的情况下解决任何问题.

                  I don't see any problem in line 2 and the error is not very descriptive. It appears to be something to do with the as keyword. If I remove it, it works fine. However, I want my queries to be very verbose. Therefore, I must figure out a way to fix whatever the problem is without removing the as keyword.

                  这是涉及的表的结构:

                  CREATE TABLE GUEST
                  (
                    GUEST_ID       NUMBER               NOT NULL,
                    LAST_NAME      VARCHAR2(50 BYTE),
                    FIRST_NAME     VARCHAR2(50 BYTE),
                    CITY           VARCHAR2(50 BYTE),
                    LOYALTY_NUMBER VARCHAR2(10 BYTE)    
                  );
                  
                  CREATE TABLE STAY
                  (
                    STAY_ID        NUMBER                         NOT NULL,
                    GUEST_ID       NUMBER                         NOT NULL,
                    HOTEL_ID       NUMBER                         NOT NULL,
                    START_DATE     DATE,
                    NUMBER_DAYS    NUMBER, 
                    ROOM           VARCHAR2(10 BYTE)
                  );
                  

                  提前感谢您的帮助.

                  推荐答案

                  您可以使用 AS 在许多 SQL 服务器(至少 MsSQL、MySQL、PostrgreSQL)上为表别名,但它始终是可选的,并且Oracle 这是非法的.

                  You can use AS for table aliasing on many SQL servers (at least MsSQL, MySQL, PostrgreSQL) but it's always optional and on Oracle it's illegal.

                  所以删除 AS :

                  SELECT G.Guest_ID, G.First_Name, G.Last_Name
                  FROM Guest G
                  

                  这篇关于如何使用“as"关键字为 Oracle 中的表设置别名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:PL/SQL 中是否有拆分字符串的函数? 下一篇:ORA-12560: TNS: 协议适配器错误

                  相关文章

                    <legend id='MwOMw'><style id='MwOMw'><dir id='MwOMw'><q id='MwOMw'></q></dir></style></legend>
                    1. <i id='MwOMw'><tr id='MwOMw'><dt id='MwOMw'><q id='MwOMw'><span id='MwOMw'><b id='MwOMw'><form id='MwOMw'><ins id='MwOMw'></ins><ul id='MwOMw'></ul><sub id='MwOMw'></sub></form><legend id='MwOMw'></legend><bdo id='MwOMw'><pre id='MwOMw'><center id='MwOMw'></center></pre></bdo></b><th id='MwOMw'></th></span></q></dt></tr></i><div id='MwOMw'><tfoot id='MwOMw'></tfoot><dl id='MwOMw'><fieldset id='MwOMw'></fieldset></dl></div>
                      <tfoot id='MwOMw'></tfoot>
                        <bdo id='MwOMw'></bdo><ul id='MwOMw'></ul>

                      <small id='MwOMw'></small><noframes id='MwOMw'>