0% found this document useful (0 votes)
20 views2 pages

Corat Core T

The document shows SQL commands used to create databases, tables, and insert data in MariaDB. It creates a Universitas database and tables for students (mahasiswa), courses (matakuliah), and student grades (nilaiakhir). It then inserts sample data into the mahasiswa table.

Uploaded by

KARLINA KARLINA
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)
20 views2 pages

Corat Core T

The document shows SQL commands used to create databases, tables, and insert data in MariaDB. It creates a Universitas database and tables for students (mahasiswa), courses (matakuliah), and student grades (nilaiakhir). It then inserts sample data into the mahasiswa table.

Uploaded by

KARLINA KARLINA
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/ 2

MariaDB [(none)]> create database Universitas;

Query OK, 1 row affected (0.00 sec)


'
MariaDB [(none)]> use Universitas;
Database changed
MariaDB [Universitas]> create table mahasiswa(nim char(13) not null,nama_mahasiswa
varchar(50),alamat varchar(30),kodepos char(5),telpon char(14));
Query OK, 0 rows affected (0.18 sec)

MariaDB [Universitas]> show table mahasiswa;


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
'mahasiswa' at line 1
MariaDB [Universitas]> select*from mahasiswa;
Empty set (0.00 sec)

MariaDB [Universitas]> desc mahasiswa;


+----------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------+-------+
| nim | char(13) | NO | | NULL | |
| nama_mahasiswa | varchar(50) | YES | | NULL | |
| alamat | varchar(30) | YES | | NULL | |
| kodepos | char(5) | YES | | NULL | |
| telpon | char(14) | YES | | NULL | |
+----------------+-------------+------+-----+---------+-------+
5 rows in set (0.02 sec)

MariaDB [Universitas]> create table


matakuliah(kode_matakuliah(cha--------------------+
-> | Database |
-> +--------------------+
-> | information_schema |
-> | inventory |
-> | mysql |
-> | performance_schema |
-> | phpmyadmin |
-> | rs_uas |
-> | universitas |
-> desc mahasiswa;;
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
'(cha--------------------+
| Database |
+--------------------+
| inform' at line 1
ERROR: No query specified

MariaDB [Universitas]> create table matakuliah(kode_matakuliah char(5) not


null,nama_matakuliah varchar(10),jumlah_sks char(30));
Query OK, 0 rows affected (0.23 sec)

MariaDB [Universitas]> decs matakuliah;


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 'decs
matakuliah' at line 1
MariaDB [Universitas]> desc matakuliah;
+-----------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+-------------+------+-----+---------+-------+
| kode_matakuliah | char(5) | NO | | NULL | |
| nama_matakuliah | varchar(10) | YES | | NULL | |
| jumlah_sks | char(30) | YES | | NULL | |
+-----------------+-------------+------+-----+---------+-------+
3 rows in set (0.02 sec)

MariaDB [Universitas]> create table nilaiakhir(nim char(13)not


null,kode_matakuliah(5),nilai_uts int(3) nilai_uas int(3) grade_nilai char(1));
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
'(5),nilai_uts int(3) nilai_uas int(3) grade_nilai char(1))' at line 1
MariaDB [Universitas]> create table nilaiakhir(nim char(13)not null,kode_matakuliah
char(5),nilai_uts int(3), nilai_uas int(3), grade_nilai char(1));
Query OK, 0 rows affected (0.23 sec)

MariaDB [Universitas]> desc nilaiakhir;


+-----------------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+----------+------+-----+---------+-------+
| nim | char(13) | NO | | NULL | |
| kode_matakuliah | char(5) | YES | | NULL | |
| nilai_uts | int(3) | YES | | NULL | |
| nilai_uas | int(3) | YES | | NULL | |
| grade_nilai | char(1) | YES | | NULL | |
+-----------------+----------+------+-----+---------+-------+
5 rows in set (0.02 sec)

MariaDB [Universitas]> insert into


mahasiswa(nim,nama_mahasiswa,alamat,kota,kodepos,telpon)values(43A87001,'ALDI','jl.
anggrek','bekasi','17111','0812345'),
(43A87002,'BAGUS','jl.teratai','bekasi','17112','0811111'),
(43A87003,'KYUHYUN','jl.matahari','jawatimur','17113','0811111'),
(43A87004,'Donghae','jl.tulip','jambi','17114','0811112'),
(43A87005,'jl.setu','bekasi selatan','17115,'08111113'),
(43A87006,'EUNHYUK','jl.abc','bekasi utara','17116','08111116'),
(43A87007,'MINHO','jl.agus salim','bekasi','17117','08111117'),
(43A87008,'ryeowook','jl.kamboja','ciamis','17118','08111118'),
(43A87009,'heechul','jl.soekarno','bandung','17119','08111119'),
(43A87010,'leeteuk','jl.bumi anggrek','kranji','17110','08111110'),
(43A87011,'heechul','jl.soekarno','bandung','17111','081111113'),
(43A87012,'dino','jl.hatta','bandung','17111','081111114'),
(43A87013,'mingyu','jl.badai','sukabumi','17115','081111120')
(43A87015,'shindong','jl.kacang','bandung utara','17141','081111119'),
((43A87016,'nam joo hyuk','jl.hasibuan','bekasi','17116','081111116'),
(43A87017,'mark','jl.teratai2','bandung','17118','081111121'),
(43A87018,'taeyong','jl.teratai3','bekasi timur','17118','081111123'),
(43A87019,'heechan','jl.teratai4','bandung','17117','081111130'),
(43A87020,'shotaro','jl.soekarno2','bandung','17111','081111132');

You might also like