TABLE
: Customer
KEY
:- CustomerID
Other
columns: Name, age, etc TABLE
: Customer_address
Keys
: AddrerssID, CustomerID
Other
columns: Street, city, STATE, etc
请给我所有客户。
如果state = FL
,我还想查看客户地址。只创建一个SQL语句。下面的SQL以这种方式启动。请填写其余部分。
答案 0 :(得分:1)
SELECT C.CustomerID, C.Name, C.Age, CA.AddressID, CA.Street, CA.City, CA.State
FROM Customer C
LEFT JOIN Customer_Address CA ON C.CustomerID = CA.CustomerID AND CA.State = 'FL'
答案 1 :(得分:0)
select Customer.*,
street,
city,
state
from Customer
left join Customer_address on Customer.CustomerID = Customer_address.CustomerID
and Customer_address.STATE = 'FL'