SQL语句中
USEpubsSELECTau1_lname,au1.au_fname,au1_cityFROMauthorsASau1WHEREau1.cityin(SELECTau2...
USE pubs
SELECT au1_lname,au1.au_fname,au1_city
FROM authors AS au1
WHERE au1.city in
(
SELECT au2.city
FROM authors AS au2
WHERE au2.au_fname = 'Livia'
AND au2.au_lname = 'Karsen'
)请大家帮帮注释一下每句语句的意思,本人很菜也是初学 展开
SELECT au1_lname,au1.au_fname,au1_city
FROM authors AS au1
WHERE au1.city in
(
SELECT au2.city
FROM authors AS au2
WHERE au2.au_fname = 'Livia'
AND au2.au_lname = 'Karsen'
)请大家帮帮注释一下每句语句的意思,本人很菜也是初学 展开
1个回答
展开全部
USE pubs --pubs是数据库的名字
SELECT au1_lname,au1.au_fname,au1_city --在authors 表中查询三个字段
FROM authors AS au1 --au1是authors 表的别名
WHERE au1.city in --where后面的条件是查询结果中的city在后面的查询中
(
SELECT au2.city -- 查询city
FROM authors AS au2 --au2是authors 的别名
WHERE au2.au_fname = 'Livia' --条件是后面这2个
AND au2.au_lname = 'Karsen'
)
SELECT au1_lname,au1.au_fname,au1_city --在authors 表中查询三个字段
FROM authors AS au1 --au1是authors 表的别名
WHERE au1.city in --where后面的条件是查询结果中的city在后面的查询中
(
SELECT au2.city -- 查询city
FROM authors AS au2 --au2是authors 的别名
WHERE au2.au_fname = 'Livia' --条件是后面这2个
AND au2.au_lname = 'Karsen'
)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询