You are on page 1of 1

nomor 1

SELECT customers.`city`, SUM(payments.`amount`) AS total_pembayaran


FROM customers
INNER JOIN payments
ON customers.`customerNumber`=payments.`customerNumber`
GROUP BY customers.`country` HAVING total_pembayaran > 200000;

nomor 2

SELECT customers.`city`, COUNT(orders.`orderNumber`)


FROM customers
INNER JOIN orders
ON customers.`customerNumber`=orders.`customerNumber`
GROUP BY customers.`country` HAVING COUNT(orders.`orderNumber`) <5;

nomor 3

SELECT COUNT(employees.`employeeNumber`) AS banyak_karyawan, offices.`city`


FROM employees
INNER JOIN offices
ON employees.`officeCode`=offices.`officeCode`
GROUP BY offices.`country` HAVING banyak_karyawan > 2;

nomor 4

SELECT COUNT(employees.`jobTitle`) AS banyak_Sales_Rep, offices.`city`


FROM employees
INNER JOIN offices
ON employees.`officeCode`=offices.`officeCode`
WHERE employees.`jobTitle` LIKE '%Rep%'
GROUP BY offices.`country` ;

nomor 5

SELECT
customers.`customerName`,products.`productName`,orders.`status`,customers.`city`
FROM customers
INNER JOIN orders
ON customers.`customerNumber`=orders.`customerNumber`
INNER JOIN orderdetails
ON orders.`orderNumber`=orderdetails.`orderNumber`
INNER JOIN products
ON orderdetails.`productCode`=products.`productCode`
WHERE customers.`city` = 'London' ;

You might also like