2. Buat database sekolah
3. Buat table siswa
Nis char(10) not null unique primary key
namaS char(25)
alamatS char(35)
kotaS char(20)
jnskel enum(‘L’,’P’)
4. Masukkan data sebagai berikut :
Nis namaS alamatS KotaS jnskel
0147 Berliana beringin 97 Pekalongan P
0148 Dimas Kapuas 86 Pekalongan L
0149 Diana Bergota 7/25 Semarang P
0150 Seto Siblat 97 Semarang L
5. Buat table maple
kodeMP char(10) not null primary key unique
NamaMP char(35)
Sks int(2)
6. Isi table maple dengan data sebagai berikut :
KodeMP namaMP sks
SBD Sistem Basis Data 4
MATH Mathemathic 2
PBD Perancangan Basis Data 4
AGM Pendidikan Agama 2
7. Buat table raport
NIS char(10) not null
KodeMP char(10) not null
Nilai int(2)
Primary key NIS, kodeMP
Catatan : jangan berikan sifat unique untuk field yang menjadi superkey
8. Isi table raport dengan data sebagai berikut :
langkah-langkah yang harus anda eksperimenkan'...monggo''
Enter password: root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.51-community MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| sekolah |
+--------------------+
1 rows in set (0.00 sec)
mysql> use sekolah;
Database changed
mysql> create table siswa(
-> nis char(10) not null unique,
-> namaS char(25),
-> alamatS char(35),
-> kotaS char(20),
-> jnskel enum('L','P'),
-> primary key(nis));
Query OK, 0 rows affected (0.14 sec)
mysql> insert into siswa values
-> ('0147','berliana','beringin 97','pekalongan','P'),
-> ('0148','dimas','kapuas 86','pekalongan','L'),
-> ('0149','diana','bergota 7/25','semarang','P'),
-> ('0150','seto','siblat 97','semarang','L');
Query OK, 4 rows affected (0.05 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql> create table maple(
-> kodeMP char(10)not null unique,
-> NamaMP char(35),
-> Sks int(2),
-> primary key(kodeMP));
Query OK, 0 rows affected (0.06 sec)
mysql> insert into maple values
-> ('SBD','Sistem basis Data','4'),
-> ('MATH','mathemathic','2'),
-> ('PBD','Perancangan Basis Data','4'),
-> ('AGM','Pendidikan Agama','2');
Query OK, 4 rows affected (0.03 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql> create table raport(
-> Nis char(10) not null,
-> kodeMP char(10) not null,
-> Nilai int(2),
-> primary key(Nis,KodeMp));
Query OK, 0 rows affected (0.08 sec)
mysql> insert into raport values
-> ('0147','SBD',70),
-> ('0147','MATH',80),
-> ('0147','PBD',90),
-> ('0147','AGM',95),
-> ('0148','SBD',90),
-> ('0148','MATH',90),
-> ('0148','PBD',80),
-> ('0148','AGM',80),
-> ('0149','SBD',70),
-> ('0149','MATH',70),
-> ('0149','PBD',60),
-> ('0149','AGM',60);
Query OK, 12 rows affected (0.03 sec)
Records: 12 Duplicates: 0 Warnings: 0
mysql> selamat untuk anda.
0 comments:
Posting Komentar
silahkan tinggalkan komentar anda :