Complete the code to select all columns from both tables using a CROSS JOIN.
SELECT * FROM products [1] orders;The CROSS JOIN keyword returns the Cartesian product of the two tables, combining every row of the first table with every row of the second table.
Complete the code to count the total number of rows produced by a CROSS JOIN between two tables.
SELECT COUNT(*) FROM customers [1] products;Using CROSS JOIN combines every row from customers with every row from products, so counting the rows gives the total number of combinations.
Fix the error in the CROSS JOIN syntax to correctly produce the Cartesian product.
SELECT * FROM sales [1] JOIN products;The correct syntax for a CROSS JOIN is CROSS JOIN. Omitting the word JOIN or using another join type changes the meaning or causes errors.
Fill both blanks to write a query that selects product names and customer names from a CROSS JOIN.
SELECT products.name AS product_name, customers.name AS customer_name FROM products [1] [2] customers;
To get all combinations of products and customers, use CROSS JOIN between the two tables.
Fill all three blanks to write a query that counts the Cartesian product rows and filters products with price greater than 100.
SELECT COUNT(*) FROM products [1] [2] orders WHERE products.price [3] 100;
The query uses CROSS JOIN to combine products and orders. The WHERE clause filters products with price greater than 100 using >.