# SQL ‘SUM’ Function

28 01 2010

Fungsi SQL SUM akan mengembalikan fungsi jumlah total dari kolom numerik.

Struktur:
SELECT SUM(nama_kolom) FROM nama_tabel

Example :

Dari tabel berikut akan dihitung total dari tabel hobi, kolom usia

Nama tabel : ‘tabel_hobi’

No. Usia Nama Hobi
1 20 joko makan
2 21 anto tidur
3 23 budi makan
4 21 dewi basket
5 24 dea makan
6 24 lia tidur

SELECT SUM(usia) AS totalusia FROM tabel_hobi


Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: