0% found this document useful (0 votes)
38 views4 pages

PLD DB

The document shows the steps to create a student database in MariaDB. It connects to the MariaDB server as the root user, creates a new database called db_mhs, then creates a table called mhs with fields for student number, name, student ID, class, major, and faculty. Three students are then inserted into the mhs table.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views4 pages

PLD DB

The document shows the steps to create a student database in MariaDB. It connects to the MariaDB server as the root user, creates a new database called db_mhs, then creates a table called mhs with fields for student number, name, student ID, class, major, and faculty. Three students are then inserted into the mhs table.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

NoMicrosoft Windows [Version 10.0.22621.

1702]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Aspire 3>cd c:\xampp\mysql\bin

c:\xampp\mysql\bin>cd xampp/mysql/bin
The system cannot find the path specified.

c:\xampp\mysql\bin>mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 29
Server version: 10.4.28-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)]> show databases;


+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| perpustakaan |
| phpmyadmin |
| test |
+--------------------+
6 rows in set (0.002 sec)
MariaDB [(none)]> create database db_mhs;
Query OK, 1 row affected (0.004 sec)

MariaDB [(none)]> show databases;


+--------------------+
| Database |
+--------------------+
| db_mhs |
| dh_mhs |
| information_schema |
| mysql |
| performance_schema |
| perpustakaan |
| phpmyadmin |
| test |
+--------------------+
8 rows in set (0.001 sec)

MariaDB [(none)]> use db_mhs;


Database changed
MariaDB [db_mhs]> create table mhs(no int(4));
Query OK, 0 rows affected (0.027 sec)

MariaDB [db_mhs]> alter table mhs add nama varchar(50);


Query OK, 0 rows affected (0.027 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [db_mhs]> alter table mhs add npm char(13);


Query OK, 0 rows affected (0.020 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [db_mhs]> alter table mhs add kelas varchar(1);
Query OK, 0 rows affected (0.021 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [db_mhs]> alter table mhs add prodi varchar(25);


Query OK, 0 rows affected (0.022 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [db_mhs]> alter table mhs add fakultas varchar(25);


Query OK, 0 rows affected (0.024 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [db_mhs]> insert into values('1','sheryl ayesha','2210631230039','b','teknik


kimia','ft');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near 'values('1','sheryl
ayesha','2210631230039','b','teknik kimia','ft')' at line 1
MariaDB [db_mhs]> insert into mhs values('1','sheryl ayesha','2210631230039','b','teknik
kimia','ft');
Query OK, 1 row affected (0.004 sec)

MariaDB [db_mhs]> select*from mhs;


+------+---------------+---------------+-------+--------------+----------+
| no | nama | npm | kelas | prodi | fakultas |
+------+---------------+---------------+-------+--------------+----------+
| 1 | sheryl ayesha | 2210631230039 | b | teknik kimia | ft |
+------+---------------+---------------+-------+--------------+----------+
1 row in set (0.001 sec)

MariaDB [db_mhs]> insert into mhs values('2','desi karnisa','2210631230048','b','teknik


kimia','ft');
Query OK, 1 row affected (0.004 sec)

MariaDB [db_mhs]> select*from mhs;


+------+---------------+---------------+-------+--------------+----------+
| no | nama | npm | kelas | prodi | fakultas |
+------+---------------+---------------+-------+--------------+----------+
| 1 | sheryl ayesha | 2210631230039 | b | teknik kimia | ft |
| 2 | desi karnisa | 2210631230048 | b | teknik kimia | ft |
+------+---------------+---------------+-------+--------------+----------+
2 rows in set (0.001 sec)

MariaDB [db_mhs]> insert into mhs values('3','rantika sekar','2210631230036','b','teknik


kimia','ft');
Query OK, 1 row affected (0.004 sec)

MariaDB [db_mhs]> select*from mhs;


+------+---------------+---------------+-------+--------------+----------+
| no | nama | npm | kelas | prodi | fakultas |
+------+---------------+---------------+-------+--------------+----------+
| 1 | sheryl ayesha | 2210631230039 | b | teknik kimia | ft |
| 2 | desi karnisa | 2210631230048 | b | teknik kimia | ft |
| 3 | rantika sekar | 2210631230036 | b | teknik kimia | ft |
+------+---------------+---------------+-------+--------------+----------+
3 rows in set (0.001 sec)

MariaDB [db_mhs]>

You might also like