0
   create table PlatonicForms (name varchar(20), sides integer(3));
   create table Colors (hex varchar(6), color varchar(20));
   create table MorePlatonics (name varchar(20), sides integer(3));
   create table ShapesColors(color varchar(20), shape varchar(20));

I am trying to use this intersect

SELECT *
FROM PlatonicForms
INTERSECT
SELECT *
FROM MorePlatonics;

but I get this error

ERROR 1064 (42000): 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 'SELECT * FROM MorePlatonics' at line 3

I don't know what I am doing wrong

Bill Karwin
  • 538,548
  • 86
  • 673
  • 828
  • I have removed the [tag:sql-server] tag, as this is clearly MySQL due to the DDL using `integer(3)` and the error. This, however, demonstrates why knowing your RDBMS is important as, according to a quick Google, MySQL does not support `INTERSECT`. – Thom A Nov 02 '20 at 18:25

1 Answers1

0

mysql doesn't support INTERSECT syntax, try this:

 SELECT DISTINCT 
   name,sides 
FROM PlatonicForms
   INNER JOIN MorePlatonics USING(name,sides);