KEMBAR78
MariaDB Database Setup Guide | PDF | My Sql | Data Management Software
0% found this document useful (0 votes)
108 views4 pages

MariaDB Database Setup Guide

1. The document describes the creation of tables for a student grade database in MySQL. Tables are created for students, courses, instructors, course enrollment, and student grades. Sample data is inserted into each table. 2. Key tables created include students (with name, gender, address, major), courses (with code, name, credits), instructors (with ID, name, education, address), course enrollment, and student grades (with exam scores). 3. The schema is checked after each table is built and sample data is inserted into each table to test the structure.

Uploaded by

Kevin Goldra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views4 pages

MariaDB Database Setup Guide

1. The document describes the creation of tables for a student grade database in MySQL. Tables are created for students, courses, instructors, course enrollment, and student grades. Sample data is inserted into each table. 2. Key tables created include students (with name, gender, address, major), courses (with code, name, credits), instructors (with ID, name, education, address), course enrollment, and student grades (with exam scores). 3. The schema is checked after each table is built and sample data is inserted into each table to test the structure.

Uploaded by

Kevin Goldra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

Nama : Kevin Goldra Hermanto

NIM : 20180801269
Jurusan : Teknik Informatika

Microsoft Windows [Version 10.0.18362.356]


(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\kgoldra>cd\xampp\mysql\bin

C:\xampp\mysql\bin>mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.36-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database nilai_mhs;


Query OK, 1 row affected (0.01 sec)

MariaDB [(none)]> use nilai_mhs;


Database changed
MariaDB [nilai_mhs]> create table mahasiswa
-> (no_mhs varchar(35) not null,
-> nm_mhs varchar (35) not null,
-> jen_kel char (1) not null,
-> alamat varchar (55),
-> jurusan char (2) not null,
-> primary key (no_mhs)
-> );
Query OK, 0 rows affected (0.46 sec)

MariaDB [nilai_mhs]> desc nilai_mhs.mahasiswa;


+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| no_mhs | varchar(35) | NO | PRI | NULL | |
| nm_mhs | varchar(35) | NO | | NULL | |
| jen_kel | char(1) | NO | | NULL | |
| alamat | varchar(55) | YES | | NULL | |
| jurusan | char(2) | NO | | NULL | |
+---------+-------------+------+-----+---------+-------+
5 rows in set (0.02 sec)

MariaDB [nilai_mhs]> create table matakuliah


-> (kd_mtkul char(7) not null,
-> mt_kul char (25) not null,
-> sks int (2) not null,
-> primary key (kd_mtkul)
-> );
Query OK, 0 rows affected (0.04 sec)

MariaDB [nilai_mhs]> desc nilai_mhs.matakuliah;


+----------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+----------+------+-----+---------+-------+
| kd_mtkul | char(7) | NO | PRI | NULL | |
| mt_kul | char(25) | NO | | NULL | |
| sks | int(2) | NO | | NULL | |
+----------+----------+------+-----+---------+-------+
3 rows in set (0.02 sec)

MariaDB [nilai_mhs]> create table dosen


-> (kd_dosen char(7) not null,
-> nama varchar (25) not null,
-> pendidikan varchar (25) not null,
-> alamat varchar (55),
-> primary key (kd_dosen)
-> );
Query OK, 0 rows affected (0.10 sec)

MariaDB [nilai_mhs]> desc nilai_mhs.dosen;


+------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+-------+
| kd_dosen | char(7) | NO | PRI | NULL | |
| nama | varchar(25) | NO | | NULL | |
| pendidikan | varchar(25) | NO | | NULL | |
| alamat | varchar(55) | YES | | NULL | |
+------------+-------------+------+-----+---------+-------+
4 rows in set (0.07 sec)

MariaDB [nilai_mhs]> create table mengajar


-> (no_ajar int (3) auto_increment not null,
-> kd_dosen char (7) not null,
-> primary key (no_ajar)
-> );
Query OK, 0 rows affected (0.03 sec)

MariaDB [nilai_mhs]> desc nilai_mhs.mengajar;


+----------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+---------+------+-----+---------+----------------+
| no_ajar | int(3) | NO | PRI | NULL | auto_increment |
| kd_dosen | char(7) | NO | | NULL | |
+----------+---------+------+-----+---------+----------------+
2 rows in set (0.07 sec)

MariaDB [nilai_mhs]> create table penilaian


-> (no_nilai int (3) auto_increment not null,
-> no_mhs char (11) not null,
-> no_ajar int (3) not null,
-> nilai_uts int (3) not null,
-> nilai_uas int (3) not null,
-> primary key (no_nilai)
-> );
Query OK, 0 rows affected (0.37 sec)

MariaDB [nilai_mhs]> desc nilai_mhs.penilaian;


+-----------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+----------+------+-----+---------+----------------+
| no_nilai | int(3) | NO | PRI | NULL | auto_increment |
| no_mhs | char(11) | NO | | NULL | |
| no_ajar | int(3) | NO | | NULL | |
| nilai_uts | int(3) | NO | | NULL | |
| nilai_uas | int(3) | NO | | NULL | |
+-----------+----------+------+-----+---------+----------------+
5 rows in set (0.01 sec)

MariaDB [nilai_mhs]> show tables from nilai_mhs;


+---------------------+
| Tables_in_nilai_mhs |
+---------------------+
| dosen |
| mahasiswa |
| matakuliah |
| mengajar |
| penilaian |
+---------------------+
5 rows in set (0.00 sec)

MariaDB [nilai_mhs]> insert into mahasiswa values


-> ('124390001','prasetyo','L','jl.pelangi','MI'),
-> ('124390002','raka','L','jl.mawar','MI'),
-> ('124390003','budi nugroho','L','jl.jambu','MI'),
-> ('124390004','diana nabila','P','jl.melati','MI'),
-> ('124390005','habiburohman','L','jl.kancil','MI');
Query OK, 5 rows affected (0.00 sec)
Records: 5 Duplicates: 0 Warnings: 0

MariaDB [nilai_mhs]> select * from mahasiswa;


+-----------+--------------+---------+------------+---------+
| no_mhs | nm_mhs | jen_kel | alamat | jurusan |
+-----------+--------------+---------+------------+---------+
| 124390001 | prasetyo | L | jl.pelangi | MI |
| 124390002 | raka | L | jl.mawar | MI |
| 124390003 | budi nugroho | L | jl.jambu | MI |
| 124390004 | diana nabila | P | jl.melati | MI |
| 124390005 | habiburohman | L | jl.kancil | MI |
+-----------+--------------+---------+------------+---------+
5 rows in set (0.00 sec)

MariaDB [nilai_mhs]> insert into matakuliah values


-> ('TID1031','algoritma & pemprograman I',2),
-> ('TIK1001','jaringan komputer',4),
-> ('SIK0113','sistem informasi',3),
-> ('SID1010','pemprograman visual',2),
-> ('MIK0551','struktur data',4);
Query OK, 5 rows affected, 1 warning (0.00 sec)
Records: 5 Duplicates: 0 Warnings: 1

MariaDB [nilai_mhs]> select * from matakuliah;


+----------+--------------------------+-----+
| kd_mtkul | mt_kul | sks |
+----------+--------------------------+-----+
| MIK0551 | struktur data | 4 |
| SID1010 | pemprograman visual | 2 |
| SIK0113 | sistem informasi | 3 |
| TID1031 | algoritma & pemprograman | 2 |
| TIK1001 | jaringan komputer | 4 |
+----------+--------------------------+-----+
5 rows in set (0.00 sec)

MariaDB [nilai_mhs]> insert into dosen values


-> ('0010101','Azhar Zahidah,S.Kom.,MT','STMIKJ,M Teknik UI','Tanggerang'),
-> ('0010102','Muhammad Ilyas,SE.MM','Ekonomi Gunadarma','Jakarta'),
-> ('0010103','Siti Aisyah,S.Kom.,M.Kom','M Teknik UGM','Jakarta');
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0

MariaDB [nilai_mhs]> select * from dosen;


+----------+--------------------------+--------------------+------------+
| kd_dosen | nama | pendidikan | alamat |
+----------+--------------------------+--------------------+------------+
| 0010101 | Azhar Zahidah,S.Kom.,MT | STMIKJ,M Teknik UI | Tanggerang |
| 0010102 | Muhammad Ilyas,SE.MM | Ekonomi Gunadarma | Jakarta |
| 0010103 | Siti Aisyah,S.Kom.,M.Kom | M Teknik UGM | Jakarta |
+----------+--------------------------+--------------------+------------+
3 rows in set (0.00 sec)

MariaDB [nilai_mhs]> insert into penilaian (no_mhs,no_ajar,nilai_uts,nilai_uas)


values
-> ('07313100155','1',77,65),
-> ('07313100155','2',69,73),
-> ('07313100155','5',83,79),
-> ('07313100151','3',81,90),
-> ('07313100151','4',78,85),
-> ('07313100151','5',80,89),
-> ('07313100135','2',67,73),
-> ('07313100135','5',80,89),
-> ('07313100135','3',66,69),
-> ('07313100130','1',83,91),
-> ('07313100130','3',79,85),
-> ('07313100130','5',81,89),
-> ('07313100107','2',67,68),
-> ('07313100107','3',74,82),
-> ('07313100107','4',77,80);
Query OK, 15 rows affected (0.00 sec)
Records: 15 Duplicates: 0 Warnings: 0

MariaDB [nilai_mhs]> select * from penilaian;


+----------+-------------+---------+-----------+-----------+
| no_nilai | no_mhs | no_ajar | nilai_uts | nilai_uas |
+----------+-------------+---------+-----------+-----------+
| 1 | 07313100155 | 1 | 77 | 65 |
| 2 | 07313100155 | 2 | 69 | 73 |
| 3 | 07313100155 | 5 | 83 | 79 |
| 4 | 07313100151 | 3 | 81 | 90 |
| 5 | 07313100151 | 4 | 78 | 85 |
| 6 | 07313100151 | 5 | 80 | 89 |
| 7 | 07313100135 | 2 | 67 | 73 |
| 8 | 07313100135 | 5 | 80 | 89 |
| 9 | 07313100135 | 3 | 66 | 69 |
| 10 | 07313100130 | 1 | 83 | 91 |
| 11 | 07313100130 | 3 | 79 | 85 |
| 12 | 07313100130 | 5 | 81 | 89 |
| 13 | 07313100107 | 2 | 67 | 68 |
| 14 | 07313100107 | 3 | 74 | 82 |
| 15 | 07313100107 | 4 | 77 | 80 |
+----------+-------------+---------+-----------+-----------+
15 rows in set (0.00 sec)

MariaDB [nilai_mhs]>

You might also like