--Ini adalah beberapa contoh untuk Materi BAB 6
--ini adalah untuk perintah ALTER pada Soal R2
alter table pet
change owner owner_pet varchar(20) not null;
--untuk perintah between
select * from siswa
where noinduk between 20000 and 22210;
--perintah untuk limit
select * from siswa
limit 2,3;
--untuk perintah order by
select * from siswa
order by nama;
--untuk perintah group by
select *, sum(count(nama))
from siswa
group by kota;
--jawaban soal psiko2_R1
--Contoh perintah Update
update employer
set
izin = 2
where tgl_masuk between '1900-01-01' and '2000-12-30'
and izin > 7;
--Contoh perintah untuk menggunakan Group by, Having
select kota, count(kota)
from employer
group by kota
having kota = 'Surabaya';
select kota, izin + alpha + sakit as Jumlah, (izin + alpha + sakit)/3 as "rata-rata"
from employer
group by kota
having kota = 'Jakarta';
--Contoh perintah Limit
select * from employer
limit 2,4;
--jawaban soal psiko2_R2
--Contoh perintah untuk menggunakan Group by, Having
select death, count(death)
from pet
group by death
having death <> '0000-00-00';
Untuk File Latihan Soal Kognitif dan Psikomotor 2 diatas klik disini
Tidak ada komentar:
Posting Komentar