Тема: Потрібна допомога при переведенні синтаксису із MySQL на PostgreSQL
Не працюють команди при їх введенні в PostgeSQL,що потрібно змінити?
1)SELECT *
FROM products
INNER JOIN categories ON products.category_id = categories.category_id
LEFT JOIN suppliers ON products.supplier_id = suppliers.supplier_id;
2)SELECT DISTINCT employees.*
FROM employees
INNER JOIN employee_territories ON
employees.employee_id = employee_territories.employee_id
INNER JOIN territories ON
employee_territories.territory_id = territories.territory_id
INNER JOIN region ON territories.region_id = region.region_id
WHERE region.region_description = 'Northern';
3)SELECT sum(unit_price * quantity - unit_price * quantity * discount)
FROM order_details RIGHT JOIN orders
ON orders.order_id = order_details.order_id
WHERE EXTRACT(DAY FROM order_date)::int % 2 = 1;
4)CREATE OR REPLACE VIEW sums AS
SELECT
orders.ship_address,
sum(unit_price * quantity - unit_price * quantity * discount) AS sum
FROM orders LEFT JOIN order_details
ON orders.order_id = order_details.order_id
GROUP BY orders.order_id;
SELECT ship_address
FROM sums
WHERE sum = (SELECT max(sum) FROM sums);