- Home »
- Tugas Kuis Basdat
Enter password :
Create database tokobuku;
Use tokobuku;
Database changed
Create table buku
-(
-id_buku int(5) auto_increment primary key,
-judul varchar(50) not null,
-id_penulis int(5) not null,
Thn_terbit int(4) not null);
Create table penulis
-(
-id_penulis int(5) auto_increment primary key,
-nama varchar(25) not null,
-alamat varchar(25) not null);
Insert into buku values(‘00111’,’Habis Gelap Terbitlah
Pagi’,’00221’,’2048’);
Insert into buku values(‘00112’,’Huku
Perdata’,’00222’,’2369’);
Insert into buku values(‘00113’,’Azab Biduan
Dangdut’,’00223’,’2020’);
Select *from buku;
Insert into penulis values(‘00221’,’Supardi’,’Kediri’);
Insert into penulis values(‘00222’,’Suparjan’,’Yogyakarta’);
Insert into penulis values(‘00223’,’Suparman’,’Solo’);
Select *from penulis;
Update penulis set alamat=’Mojokerto’ where id_penulis
=’221’;
Select *from penulis;
Delete from penulis where id_penulis=’222’;
Select *from penulis;
Select *from buku inner join penulis on buku.id_penulis =
penulis. id_penulis;
Select *from buku where id_buku in (select id_buku from buku
where thn_terbit<2030);