資料庫摘要 6 Sql Inner

2021-06-21 15:32:23 字數 825 閱讀 2959

inner join 關鍵字在表中存在至少乙個匹配時返回行。

sql inner join 語法

select column_name(s)

from table1

inner join table2

on table1.column_name=table2.column_name;

或:

select column_name(s)

from table1

join table2

on table1.column_name=table2.column_name;

注釋:inner join 與 join 是相同的 (交集)。

select customers.customername, orders.orderid

from customers

inner join orders

on customers.customerid=orders.customerid

order by customers.customername;

也可以用上面的寫法,等同下面

select customers.customername, orders.orderid

from customers , orders

where customers.customerid=orders.customerid

order by customers.customername;

獲取更多的資訊

摘要 資料庫 ClickHouse DDL

create database if not exists db name on cluster cluster create table if not exists db.table name on cluster cluster name1 type1 default materialized ...

資料庫摘要 5 Sql IN

in 操作符允許您在 where 子句中查詢多個值。select column name s from table name where column name in value1,value2,使用northwind樣本資料庫 select from customers where city in...

資料庫摘要 7 Sql Outer

left join 關鍵字從左表 table1 返回所有的行,即使右表 table2 中沒有匹配。如果右表中沒有匹配,則結果為 null。sql left join 語法 select column name s from table1 left join table2 on table1.colu...