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

Membuat Database Menggunakan CMD

The document shows how to create a database and table using MySQL. It demonstrates creating a database called db_kampus and a table called tbl_mahasiswa to store student data. Several insert statements are attempted with errors before successfully inserting two records into the table.

Uploaded by

Riandi Akbar
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)
30 views4 pages

Membuat Database Menggunakan CMD

The document shows how to create a database and table using MySQL. It demonstrates creating a database called db_kampus and a table called tbl_mahasiswa to store student data. Several insert statements are attempted with errors before successfully inserting two records into the table.

Uploaded by

Riandi Akbar
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

use showin1,C:\Users\AL COMPUTER>cd..

C:\Users>cd..

C:\>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 9
Server version: 10.4.18-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 database;


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
'database' at line 1
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| ande |
| apitf2 |
| apotek |
| db_arif |
| db_penjualanmobil |
| db_simsekolah |
| information_schema |
| mysql |
| performance_schema |
| phpmyadmin |
| riandi |
| syaripul_maula |
| test |
+--------------------+
13 rows in set (0.025 sec)

MariaDB [(none)]> create database db_kampus;


Query OK, 1 row affected (0.003 sec)

MariaDB [(none)]> use db_kampus;


Database changed
MariaDB [db_kampus]> create table tbl_mahasiswa(
-> id int(11) not null auto_increment,
-> nim char (8) default null,
-> nama varchar (200) default null,
-> jk char (1) default null,
-> alamat text,
-> jurusan varchar (200) default null,
-> primary key(id));
Query OK, 0 rows affected (0.030 sec)

MariaDB [db_kampus]> show tables;


+---------------------+
| Tables_in_db_kampus |
+---------------------+
| tbl_mahasiswa |
+---------------------+
1 row in set (0.003 sec)

MariaDB [db_kampus]> desc tbl_mahasiswa;


+---------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| nim | char(8) | YES | | NULL | |
| nama | varchar(200) | YES | | NULL | |
| jk | char(1) | YES | | NULL | |
| alamat | text | YES | | NULL | |
| jurusan | varchar(200) | YES | | NULL | |
+---------+--------------+------+-----+---------+----------------+
6 rows in set (0.012 sec)

MariaDB [db_kampus]> insert into tbl_mahasiswa (id, nim, nama, jk, alamat, jurusan)
values
-> 1
-> 1,
->
->
->
->
->
->
->
->
->
->
->
->
->
->
->
-> 1,
-> 1511999,
-> muhammad al fatih,
-> L,
-> Jl.P.Puger 2 No 19,
-> informatika;
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 '1
1,
1,
1511999,
muhammad al fatih,
L,
Jl.P.Puger 2 No 19,
in...' at line 2
MariaDB [db_kampus]> insert into tbl_mahasiswa (id, nim, nama, jk, alamat,
jurusan)values;
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 '' at
line 1
MariaDB [db_kampus]> insert into tbl_mahasiswa (id, nim, nama, jk, alamat, jurusan)
values (1, 15119999, muhammad al fatih, L, Jl.P.Puger 2 No 19, informatika), (2,
16119212, Fatimah, P, Jl.Ringin Raya, Sistem Informasi);
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 'al
fatih, L, Jl.P.Puger 2 No 19, informatika), (2, 16119212, Fatimah, P, Jl.R...' at
line 1
MariaDB [db_kampus]> insert into tbl_mahasiswa (id, nim, nama, jk, alamat, jurusan)
values (1, 15119999, muhammad al fatih, L, Jl.P.Puger 2 No 19, informatika), (2,
16119212, Fatimah, P, Jl.Ringin Raya, Sistem Informasi);
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 'al
fatih, L, Jl.P.Puger 2 No 19, informatika), (2, 16119212, Fatimah, P, Jl.R...' at
line 1
MariaDB [db_kampus]> insert into tbl_mahasiswa (id, nim, nama, jk, alamat,
jurusan)values
-> 1,
-> 15119999,
-> muhammad al fatih,
-> L,
-> Jl.p.Puger 2 No 19,
-> Informatika;
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 '1,
15119999,
muhammad al fatih,
L,
Jl.p.Puger 2 No 19,
Informatika' at line 2
MariaDB [db_kampus]> insert into tbl_mahasiswa (id, nim, nama, jk, alamat,
jurusan)values
-> (1, 15119999, muhammad al fatih, L, Jl.P.Puger 2 No 19, Informatika),
(2,16119212,fatimah,P,Jl.Ringin Raya,Sistem Informasi);
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 'al
fatih, L, Jl.P.Puger 2 No 19, Informatika),(2,16119212,fatimah,P,Jl.Ringin...' at
line 2
MariaDB [db_kampus]> insert into tbl_mahasiswa (id, nim, nama, jk, alamat,
jurusan)values
-> ('1','15119999','muhammad al fatih','L','Jl.P.Puger 2 No 19','informatika'),
('2','16119212','fatimah','P','Jl.Ringin Raya','Sistem Infromasi');
Query OK, 2 rows affected (0.021 sec)
Records: 2 Duplicates: 0 Warnings: 0

MariaDB [db_kampus]> select *from tbl_mahasiswa;


+----+----------+-------------------+------+--------------------+------------------
+
| id | nim | nama | jk | alamat | jurusan
|
+----+----------+-------------------+------+--------------------+------------------
+
| 1 | 15119999 | muhammad al fatih | L | Jl.P.Puger 2 No 19 | informatika
|
| 2 | 16119212 | fatimah | P | Jl.Ringin Raya | Sistem Infromasi
|
+----+----------+-------------------+------+--------------------+------------------
+
2 rows in set (0.003 sec)

MariaDB [db_kampus]>

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy