sql子查询

子查询

语法:select * from 表名 where 字段1 条件1 (select * from 表名 where 字段2 条件2);

--查询出工资比赵云高的员工信息
    SELECT * from people WHERE PeopleSalary>( select  peoplesalary from people where PeopleName='赵云');
--查询和赵云再同一个城市的员工信息
    select * from people where PeopleAddress=(SELECT PeopleAddress from people where PeopleName='赵云');
posted @ 2022-06-30 11:15  来个橙子  阅读(44)  评论(0)    收藏  举报