国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

175. Combine Two Tables

2024-07-21 02:52:25
字體:
來源:轉載
供稿:網友

Table: Person

+-------------+---------+| Column Name | Type    |+-------------+---------+| PersonId    | int     || FirstName   | varchar || LastName    | varchar |+-------------+---------+PersonId is the PRimary key column for this table.

Table: Address

+-------------+---------+| Column Name | Type    |+-------------+---------+| AddressId   | int     || PersonId    | int     || City        | varchar || State       | varchar |+-------------+---------+AddressId is the primary key column for this table.

Write a SQL query for a report that provides the following information for each person in the Person table, regardless if there is an address for each of those people:

FirstName, LastName, City, State

這里要求不論Address信息有沒有都要保留Person的信息,這里是left join.

select Person.FirstName, Person.LastName, Address.City, Address.State from Personleft join Addresson Person.PersonId=Address.PersonId;SQL 連接:

1. INNER JOIN:如果表中有至少一個匹配,則返回行;

2. LEFT JOIN:即使右表中沒有匹配,也從左表返回所有的行;

3. RIGHT JOIN:即使左表中沒有匹配,也從右表返回所有的行

來自:點擊打開鏈接


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 乐陵市| 图木舒克市| 大冶市| 龙海市| 板桥市| 临夏县| 澳门| 延寿县| 石首市| 静海县| 措美县| 余江县| 炎陵县| 苍溪县| 台南市| 广灵县| 沙田区| 那坡县| 雅江县| 揭东县| 广饶县| 萝北县| 八宿县| 阆中市| 泰来县| 鄱阳县| 固原市| 黎川县| 弋阳县| 淮滨县| 自贡市| 车险| 陈巴尔虎旗| 南木林县| 永昌县| 米泉市| 久治县| 汤原县| 庆元县| 共和县| 略阳县|