mysql8.0.28 用的是datagrip,用intersect求交集一直报错,提示语法错误,但是,实在没找到
select sname from Test.student where sdept = '信息院'
intersect
select sname from Test.student where sage <= 19;
[42000][1064] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'intersect select sname from Test.student where sage <= 19' at line 2
mysql 不支持intersect的语法,建议使用其他方式来实现,比如你这个sql完全可以写成
select sname from Test.student where sdept = '信息院' and sage <= 19