表1: person+-------------+---------+
| 列名 | 型別 |
+-------------+---------+
| personid | int |
| firstname | varchar |
| lastname | varchar |
+-------------+---------+
personid 是上表主鍵
表2: address+-------------+---------+
| 列名 | 型別 |
+-------------+---------+
| addressid | int |
| personid | int |
| city | varchar |
| state | varchar |
+-------------+---------+
addressid 是上表主鍵
編寫乙個 sql 查詢,滿足條件:無論 person 是否有位址資訊,都需要基於上述兩表提供 person 的以下資訊:firstname, lastname, city, state
# write your mysql query statement below
select firstname, lastname, city, state
from person
left join address
on person.personid=address.personid
175 組合兩個表
表1 person 列名 型別 personid int firstname varchar lastname varchar personid 是上表主鍵 表2 address 列名 型別 addressid int personid int city varchar state varchar ...
175 組合兩個表
sql架構 表1 person 列名 型別 personid int firstname varchar lastname varchar personid 是上表主鍵 表2 address 列名 型別 addressid int personid int city varchar state va...
175 組合兩個表
表1 person personid primary key,int firstname varchar lastname varchar personid 是上表主鍵 表2 address addressid primary key,int personid int city varchar st...