Tugas 8 Database
Praktikum 8
create
database perusahaan
use
perusahaan
create
table jabatan (
kdjab
char (4) primary key,
namajab
varchar (15))
insert
into jabatan values ( '3001' , 'sekretaris' )
insert
into jabatan values ( '3002' , 'Direktur' )
create
table pegawai (
NIP
char (4)not null primary key,
Namapeg
varchar (30),
Alamat
varchar(30),
Jnsklmn
varchar (1),
Agama
varchar (10),
Kdjab
char (4) references jabatan (kdjab))
insert
into pegawai values ('2001' , 'ocha' , 'jln.medan' , 'P', 'islam', '3001' )
insert
into pegawai values ('2002' , 'Mira' , 'jln.Jawa' , 'P', 'islam', '3002' )
select
* from jabatan
select
* from pegawai
select
* from pegawai CROSS JOIN Jabatan
select
P.NIP, P.Namapeg, J.namajab from pegawai P Inner Join jabatan J on P.kdjab =
J.kdjab
Komentar
Posting Komentar