Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select *
- from sales
- -- Fungsi Agregat
- -- SUM
- -- menghitung total pendapatan seluruh transaksi
- select SUM(quantity*price) as total_revenue -- rumus revenue / omzet = jumlah barang terjual * harga satuan
- from sales;
- -- menghitung total jumlah barang yang terjual
- select SUM(quantity) as total_quantity_sold
- from sales;
- -- COUNT()
- -- menghitung jumlah data di kolom tertentu
- select count(order_id)
- from sales;
- -- menghitung jumlah baris di sebuah tabel
- select count(*)
- from sales;
Advertisement
Add Comment
Please, Sign In to add comment