<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ``` -- 演示用表people 0: jdbc:hive2://hadoop101:10000> select * from people; +-------------------+---------------------+--------------------+---------------------------+--+ | people.people_id | people.people_name | people.people_age | people.people_start_date | +-------------------+---------------------+--------------------+---------------------------+--+ | 1 | tom | 23 | 2019-03-16 | | 2 | jack | 12 | 2019-03-13 | | 3 | robin | 14 | 2018-08-13 | | 4 | justin | 34 | 2018-10-12 | | 5 | jarry | 24 | 2017-11-11 | | 6 | jasper | 24 | 2017-12-12 | +-------------------+---------------------+--------------------+---------------------------+--+ ``` <br/> **1. CTAS方式建表 - `as select`** * CTAS方式不能創建partition表、external表、bucket表; ```sql -- 將people表的數據復制一份到ctas_people表中 create table if not exists ctas_people as select * from people; 0: jdbc:hive2://hadoop101:10000> select * from ctas_people; +------------------------+--------------------------+-------------------------+--------------------------------+--+ | ctas_people.people_id | ctas_people.people_name | ctas_people.people_age | ctas_people.people_start_date | +------------------------+--------------------------+-------------------------+--------------------------------+--+ | 1 | tom | 23 | 2019-03-16 | | 2 | jack | 12 | 2019-03-13 | | 3 | robin | 14 | 2018-08-13 | | 4 | justin | 34 | 2018-10-12 | | 5 | jarry | 24 | 2017-11-11 | | 6 | jasper | 24 | 2017-12-12 | +------------------------+--------------------------+-------------------------+--------------------------------+--+ ``` 在hdfs中的位置為,我當前使用的數據庫是hivebook: ```sql /hivebook.db/ctas_people/000000_0 (000000_0是一個文件) ``` **2. CTE方式建表 - `as as with table_name as as`** ```sql create table if not exists cte_people as with r1 as (select people_name from r2 where people_name="jack"), r2 as (select people_name from people where people_age=12), r3 as (select people_name from people where people_age=14) select * from r1 union all select * from r3; 0: jdbc:hive2://hadoop101:10000> select * from cte_people; +-------------------------+--+ | cte_people.people_name | +-------------------------+--+ | jack | | robin | +-------------------------+--+ ``` 在hdfs中的位置為,我當前使用的數據庫是hivebook: ```sql /hivebook.db/cte_people/000000_0 (000000_0是一個文件) ``` **3. `like`方式建表,只復制表結構,不復制數據** ```sql -- 復制people表的結構到like_people表中 create table if not exists like_people like people; 0: jdbc:hive2://hadoop101:10000> select * from like_people; +------------------------+--------------------------+-------------------------+--------------------------------+--+ | like_people.people_id | like_people.people_name | like_people.people_age | like_people.people_start_date | +------------------------+--------------------------+-------------------------+--------------------------------+--+ +------------------------+--------------------------+-------------------------+--------------------------------+--+ ``` 在hdfs中的位置為,我當前使用的數據庫是hivebook: ```sql /hivebook.db/like_people ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看