Guest User

Untitled

a guest
Apr 9th, 2026
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. select *
  2. from sales
  3.  
  4. -- Fungsi Agregat
  5.  
  6. -- SUM
  7. -- menghitung total pendapatan seluruh transaksi
  8. select SUM(quantity*price) as total_revenue -- rumus revenue / omzet = jumlah barang terjual * harga satuan
  9. from sales;
  10.  
  11. -- menghitung total jumlah barang yang terjual
  12. select SUM(quantity) as total_quantity_sold
  13. from sales;
  14.  
  15. -- COUNT()
  16. -- menghitung jumlah data di kolom tertentu
  17. select count(order_id)
  18. from sales;
  19.  
  20. -- menghitung jumlah baris di sebuah tabel
  21. select count(*)
  22. from sales;
  23.  
Advertisement
Add Comment
Please, Sign In to add comment