「SQL」内部結合inner joinのサンプル

2021年8月22日

書式

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
select
カラム名
from テーブルA
inner join テーブルB
on
条件式
where
条件式
select カラム名 from テーブルA inner join テーブルB on 条件式 where 条件式
select
   カラム名
from テーブルA 
    inner  join テーブルB
on
   条件式
where
  条件式

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
select
ta.orderid
, tb.customername
from
orders ta
inner join customers tb
on ta.customerid = tb.customerid
where tb.customername like 'Tr%'
select ta.orderid , tb.customername from orders ta inner join customers tb on ta.customerid = tb.customerid where tb.customername like 'Tr%'
select
    ta.orderid
    , tb.customername 
from
    orders ta 
    inner join customers tb 
        on ta.customerid = tb.customerid
     where tb.customername like 'Tr%'

結果

OrderID CustomerName
10249 Tradição Hipermercados

 

SQL

Posted by arkgame