Minggu, 25 Maret 2018

Query Tabel Inner Join & Outer Join MySQL (Tugas 5 Manajemen dan Administrasi Basis Data)

TUGAS 5 MANAJEMEN DAN ADMINISTRASI BASIS DATA

Dosen Pengampu: Bp. Eko Purwanto




                                                        NAMA : Eko Pranoto Saputro

                                                        NIM     : 160101237

                                                        Smt      : 4 (empat) 



STMIK DUTA BANGSA SURAKARTA
2018

========================================================================

Jumat, 16 Maret 2018

Query Tabel MySQL (Tugas 4 Manajemen dan Administrasi Basis Data)

TUGAS 4 MANAJEMEN DAN ADMINISTRASI BASIS DATA

Dosen Pengampu: Bp. Eko Purwanto




                                                        NAMA : Eko Pranoto Saputro

                                                        NIM     : 160101237

                                                        Smt      : 4 (empat) 



STMIK DUTA BANGSA SURAKARTA
2018

========================================================================

Hasil Koding:
mysql> use ekopranotosaputro;
Database changed
mysql> create table anggota
(id varchar(3) primary key,Nama varchar(50),alamat varchar(50),gaji int(7));
Query OK, 0 rows affected

mysql> desc anggota;
+--------+-------------+------+-----+---------+-------+
| Field  | Type        | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------+
| id     | varchar(3)  | NO   | PRI | NULL    |       |
| Nama   | varchar(50) | YES  |     | NULL    |       |
| alamat | varchar(50) | YES  |     | NULL    |       |
| gaji   | int(7)      | YES  |     | NULL    |       |
+--------+-------------+------+-----+---------+-------+
4 rows in set

mysql> insert into anggota(id,nama,alamat,gaji) values 
('100','Arif','Surabaya','10000'),
('101','Andi','Jakarta','14000'),
('102','Burhan','Malang','12000'),
('103','Fikri','Madiun','15000'),
('104','Fariz','Malang','17000'),
('105','Sigit','Surabaya','20000'),
('106','Ifan','Kediri','16000'),
('107','Hanif','Yogyakarta','12000'),('108','Zakiudin','Surabaya','21000');
Query OK, 9 rows affected
Records: 9  Duplicates: 0  Warnings: 0

mysql> select * from anggota;
+-----+----------+------------+-------+
| id  | Nama     | alamat     | gaji  |
+-----+----------+------------+-------+
| 100 | Arif     | Surabaya   | 10000 |
| 101 | Andi     | Jakarta    | 14000 |
| 102 | Burhan   | Malang     | 12000 |
| 103 | Fikri    | Madiun     | 15000 |
| 104 | Fariz    | Malang     | 17000 |
| 105 | Sigit    | Surabaya   | 20000 |
| 106 | Ifan     | Kediri     | 16000 |
| 107 | Hanif    | Yogyakarta | 12000 |
| 108 | Zakiudin | Surabaya   | 21000 |
+-----+----------+------------+-------+
9 rows in set

Sabtu, 10 Maret 2018

Query Tabel MySQL (Tugas 3 Manajemen dan Administrasi Basis Data)

TUGAS 3 MANAJEMEN DAN ADMINISTRASI BASIS DATA

Dosen Pengampu: Bp. Eko Purwanto




                                                        NAMA : Eko Pranoto Saputro

                                                        NIM     : 160101237

                                                        Smt      : 4 (empat) 



STMIK DUTA BANGSA SURAKARTA
2018

========================================================================

Hasil Koding:

mysql> use ekopranotosaputro; Database changed mysql> create table karyawan(nopeg int(10) primary key auto_increment,nama varchar(25), Jeniskelamin char(2),kota varchar(25),kodepos char(5),tgllahir date); Query OK, 0 rows affected mysql> alter table karyawan change nopeg noid int(10) auto_increment; Query OK, 0 rows affected Records: 0 Duplicates: 0 Warnings: 0 mysql> alter table karyawan change jeniskelamin jenkel char(1); Query OK, 0 rows affected Records: 0 Duplicates: 0 Warnings: 0 mysql> desc karyawan; +----------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+----------------+ | noid | int(10) | NO | PRI | NULL | auto_increment | | nama | varchar(25) | YES | | NULL | | | jenkel | char(1) | YES | | NULL | | | kota | varchar(25) | YES | | NULL | | | kodepos | char(5) | YES | | NULL | | | tgllahir | date | YES | | NULL | | +----------+-------------+------+-----+---------+----------------+ 6 rows in set mysql> alter table karyawan rename to tabelpegawai; Query OK, 0 rows affected mysql> desc tabelpegawai; +----------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+----------------+ | noid | int(10) | NO | PRI | NULL | auto_increment | | nama | varchar(25) | YES | | NULL | | | jenkel | char(1) | YES | | NULL | | | kota | varchar(25) | YES | | NULL | | | kodepos | char(5) | YES | | NULL | | | tgllahir | date | YES | | NULL | | +----------+-------------+------+-----+---------+----------------+ 6 rows in set