Praktikum Basis Data 4
Praktikum Basis Data 4
723/Pra-MIK/122/2009
Kelas C
Pra S2 Ilmu Komputer
Universitas Gadjah Mada Yogyakarta
Tugas 4
Section 1
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.0.51b-community-nt MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
Menampilkan isi kolom FirstName, LastName, Address, City, dan State dari tabel
‘EmployeeAddressTable’
Section 2
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.51b-community-nt MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
Mengubah struktur tabel, yakni membuat Primary Key pada kolom OwnerID
atau
Section 3
Memanggil (menggunakan) database ‘Employee’
Membuat view dengan nama ‘AntView’ dengan data dari kolom ItemDesired dari tabel
‘Orders’
Memasukkan data baru ke dalam tabel ‘Antiques’ secara lengkap (seluruh field terisi)
Memasukkan data baru ke dalam tabel ‘Antiques’ pada sebagian field (kolom)
mysql> insert into Antiques (BuyerID, SellerID, Item) values
-> (21,01,'Ottoman');
Query OK, 1 row affected (0.38 sec)
Menghapus data dari ‘Antiques’ di mana Item = ‘Ottoman’ dan BuyerID = 01 serta
SellerID = 21
Meng-update data dalam tabel ‘Antiques’ dengan men-set Price = 500 dari Item yang
berupa Chair
Membuat index Name_IDX pada kolom OwnerLastName dan OwnerFirstName dari tabel
‘AntiqueOwners’
Menampilkan BuyerID dari tabel ‘Antiques’ di mana Price lebih besar dari (rerata + 100)
dari tabel ‘Antiques’
Menampilkan BuyerID dan Item dari tabel ‘Antiques’ di mana Price lebih besar sama
dengan semua Price lainnya dari tabel ‘Antiques’
Menampilkan BuyerID dari tabel ‘Antiques’ union (gabungan) OwnerID dari tabel
‘Orders’
Menampilkan OwnerID dan string ‘is in both Orders & Antiques’ dari tabel ‘Orders’ dan
‘Antiques’ di mana OwnerID = BuyerID union BuyerID dan string ‘is in Antiques only’
dari tabel ‘Antiques’ di mana BuyerID tidak ada dalam OwnerID dari tabel ‘Orders’