sql >> Base de Datos >  >> RDS >> Mysql

MySQL - ¿Mostrar todas las permutaciones?

CREATE TABLE person
SELECT 1 AS Id, 100 AS MyFK, 'John' AS f_name, 'Doe' AS l_name UNION
SELECT 2, 100, 'Little', 'Timmy';

CREATE TABLE vehicle
SELECT 1 AS Id, 100 AS MyFK, 'Car' AS item, 200 AS price UNION
SELECT 2, 100, 'Bike', 100;

SELECT p.Id, p.MyFK, p.f_name, p.l_name, v.item, v.price
FROM person p
CROSS JOIN vehicle v;