精品丰满熟女一区二区三区_五月天亚洲欧美综合网_亚洲青青青在线观看_国产一区二区精选

  • <menu id="29e66"></menu>

    <bdo id="29e66"><mark id="29e66"><legend id="29e66"></legend></mark></bdo>

  • <pre id="29e66"><tt id="29e66"><rt id="29e66"></rt></tt></pre>

      <label id="29e66"></label><address id="29e66"><mark id="29e66"><strike id="29e66"></strike></mark></address>
      學(xué)習(xí)啦 > 學(xué)習(xí)英語 > 專業(yè)英語 > 計(jì)算機(jī)英語 > 數(shù)據(jù)庫中using的用法

      數(shù)據(jù)庫中using的用法

      時(shí)間: 長(zhǎng)思709 分享

      數(shù)據(jù)庫中using的用法

        數(shù)據(jù)庫中using的用法的用法你知道嗎?下面小編就跟你們?cè)敿?xì)介紹下數(shù)據(jù)庫中using的用法的用法,希望對(duì)你們有用。

        數(shù)據(jù)庫中using的用法的用法如下:

        使用using關(guān)鍵字對(duì)連接進(jìn)行簡(jiǎn)化

        在SQL/92標(biāo)準(zhǔn)可以使用USING子句對(duì)連接條件進(jìn)行簡(jiǎn)化,但是只有在查詢滿足以下兩個(gè)條件時(shí)才能給使用USING進(jìn)行簡(jiǎn)化:

        1、查詢必須是等連接的

        2、等連接中的列必須是同名

        如:商品表goods表和商品類型表category表中g(shù)oods的外鍵和category的主鍵相同:categoryid而且是等連接,這里可以使用using

        [sql]

        select goodsname,categoryname

        from goods inner join category

        using(categoryid)

        在使用using是需要注意以下幾個(gè)問題

        1、在select子句中只能指定該列名,不能使用表名或別名

        2、在using子句中也只能單獨(dú)使用列名

        對(duì)于多與兩個(gè)表的連接,先看這個(gè)例子

        [sql]

        select c.firstName,c.lastName,p.product_name ,pt.product_types_name

        from customers c,purchase pr,products p,product_types pt

        where c.customer_id=pr.customer_id www.2cto.com

        and p.products_id = pr.products_id

        and p.product_types_id=pt.product_types_id;

        使用using對(duì)上面的sql語句進(jìn)行重寫

        [sql]

        select c.first_name,c.last_name,p.products_name as product,pt.product_types_name as typesname

        from customers c inner join purchases pr

        using(customers_id)

        inner join products p

        using(products_id)

        inner join product_types pt

        using(product_types_id);

      543244