Anda di halaman 1dari 6

Microsoft Windows [Version 10.0.17134.

286]

(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\Leandra Chika>cd..

C:\Users>cd..

C:\>cd xampp

C:\xampp>cd mysql

C:\xampp\mysql>cd bin

C:\xampp\mysql\bin>mysql -u root

Welcome to the MariaDB monitor. Commands end with ; or \g.

Your MariaDB connection id is 4

Server version: 10.1.35-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 Perusahaan_Lea;

Query OK, 1 row affected (0.02 sec)


MariaDB [(none)]> USE Perusahaan_Lea;

Database changed

MariaDB [Perusahaan_Lea]> CREATE TABLE pegawai(idpegawai CHAR(6) NOT NULL PRIMARY KEY,
namadepan VARCHAR(20), namabelakang VARCHAR(25) NOT NULL, email VARCHAR(25) NOT NULL,
telepon VARCHAR(20, tglkontrak date NOT NULL, idjob VARCHAR(10) NOT NULL, gaji INT(8), tunjangan
INT(8), idmanajer CHAR(6), iddepartemen CHAR(4));

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 ' tglkontrak date NOT NULL, idjob VARCHAR(10)
NOT NULL, gaji INT(8), tunjangan IN' at line 1

MariaDB [Perusahaan_Lea]> CREATE TABLE pegawai(idpegawai CHAR(6) NOT NULL PRIMARY KEY,
namadepan VARCHAR(20), namabelakang VARCHAR(25) NOT NULL, email VARCHAR(25) NOT NULL,
telepon VARCHAR(20, tglkontrak DATE NOT NULL, idjob VARCHAR(10) NOT NULL, gaji INT(8), tunjangan
INT(8), idmanajer CHAR(6), iddepartemen CHAR(4));

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 ' tglkontrak DATE NOT NULL, idjob VARCHAR(10)
NOT NULL, gaji INT(8), tunjangan IN' at line 1

MariaDB [Perusahaan_Lea]> CREATE TABLE pegawai(idpegawai CHAR(6) NOT NULL, namadepan


VARCHAR(20), namabelakang VARCHAR(25) NOT NULL, email VARCHAR(25) NOT NULL, telepon
VARCHAR(20, tglkontrak DATE NOT NULL, idjob VARCHAR(10) NOT NULL, gaji INT(8), tunjangan INT(8),
idmanajer CHAR(6), iddepartemen CHAR(4));

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 ' tglkontrak DATE NOT NULL, idjob VARCHAR(10)
NOT NULL, gaji INT(8), tunjangan IN' at line 1

MariaDB [Perusahaan_Lea]> CREATE TABLE pegawai (idpegawai CHAR (6) NOT NULL, namadepan
VARCHAR(20), namabelakang VARCHAR(25) NOT NULL, email VARCHAR(25) NOT NULL, telepon
VARCHAR(20), tglkontrak DATE NOT NULL, idjob VARCHAR(10) NOT NULL, gaji INT(8), tunjangan INT(8),
idmanajer CHAR(6), iddepartemen CHAR(4));

Query OK, 0 rows affected (0.29 sec)

MariaDB [Perusahaan_Lea]> DESC pegawai;

+--------------+-------------+------+-----+---------+-------+

| Field | Type | Null | Key | Default | Extra |

+--------------+-------------+------+-----+---------+-------+
| idpegawai | char(6) | NO | | NULL | |

| namadepan | varchar(20) | YES | | NULL | |

| namabelakang | varchar(25) | NO | | NULL | |

| email | varchar(25) | NO | | NULL | |

| telepon | varchar(20) | YES | | NULL | |

| tglkontrak | date | NO | | NULL | |

| idjob | varchar(10) | NO | | NULL | |

| gaji | int(8) | YES | | NULL | |

| tunjangan | int(8) | YES | | NULL | |

| idmanajer | char(6) | YES | | NULL | |

| iddepartemen | char(4) | YES | | NULL | |

+--------------+-------------+------+-----+---------+-------+

11 rows in set (0.06 sec)

MariaDB [Perusahaan_Lea]> ALTER TABLE pegawai ADD CONSTRAINT PRIMARY KEY (idpegawai);

Query OK, 0 rows affected (0.60 sec)

Records: 0 Duplicates: 0 Warnings: 0

MariaDB [Perusahaan_Lea]> DESC pegawai;

+--------------+-------------+------+-----+---------+-------+

| Field | Type | Null | Key | Default | Extra |

+--------------+-------------+------+-----+---------+-------+

| idpegawai | char(6) | NO | PRI | NULL | |

| namadepan | varchar(20) | YES | | NULL | |

| namabelakang | varchar(25) | NO | | NULL | |


| email | varchar(25) | NO | | NULL | |

| telepon | varchar(20) | YES | | NULL | |

| tglkontrak | date | NO | | NULL | |

| idjob | varchar(10) | NO | | NULL | |

| gaji | int(8) | YES | | NULL | |

| tunjangan | int(8) | YES | | NULL | |

| idmanajer | char(6) | YES | | NULL | |

| iddepartemen | char(4) | YES | | NULL | |

+--------------+-------------+------+-----+---------+-------+

11 rows in set (0.06 sec)

MariaDB [Perusahaan_Lea]> INSERT INTO pegawai VALUES ('E001', 'ferry',


'gustiawan','ferry@yahoo.com', '07117059004', '2005-09-01', 'L0001', 2000000, 500000, 'al', 'com1');

Query OK, 1 row affected (0.08 sec)

MariaDB [Perusahaan_Lea]> INSERT INTO pegawai VALUES ('E002', 'aris', 'ganiardi','aris@yahoo.com',


'081312345678', '2006-09-01', 'L0002', 2000000, 200000, 'he', 'com1');

Query OK, 1 row affected (0.06 sec)

MariaDB [Perusahaan_Lea]> INSERT INTO pegawai VALUES ('E003', 'faiz', 'ahmad','faiz@gmail.com',


'081367384322', '2006-10-01', 'L0003', 1500000, 0, 'bx', 'com1');

Query OK, 1 row affected (0.06 sec)

MariaDB [Perusahaan_Lea]> INSERT INTO pegawai VALUES ('E004', 'emma',


'bunton','emma@gmail.com', '081363484342', '2006-10-01', 'L0004', 1500000, 0, 'cx', 'com1');

Query OK, 1 row affected (0.06 sec)


MariaDB [Perusahaan_Lea]> INSERT INTO pegawai VALUES ('E005', 'nike', 'scolf','nike@plasa.com',
'08163454555', '2007-09-01', 'L0005', 1250000, 0, 'cx', 'com1');

Query OK, 1 row affected (0.07 sec)

MariaDB [Perusahaan_Lea]> SELECT * FROM pegawai;

+-----------+-----------+--------------+-----------------+--------------+------------+-------+---------+-----------+-----------+----
----------+

| idpegawai | namadepan | namabelakang | email | telepon | tglkontrak | idjob | gaji |


tunjangan | idmanajer | iddepartemen |

+-----------+-----------+--------------+-----------------+--------------+------------+-------+---------+-----------+-----------+----
----------+

| E001 | ferry | gustiawan | ferry@yahoo.com | 07117059004 | 2005-09-01 | L0001 | 2000000 |


500000 | al | com1 |

| E002 | aris | ganiardi | aris@yahoo.com | 081312345678 | 2006-09-01 | L0002 | 2000000 |


200000 | he | com1 |

| E003 | faiz | ahmad | faiz@gmail.com | 081367384322 | 2006-10-01 | L0003 | 1500000 |


0 | bx | com1 |

| E004 | emma | bunton | emma@gmail.com | 081363484342 | 2006-10-01 | L0004 |


1500000 | 0 | cx | com1 |

| E005 | nike | scolf | nike@plasa.com | 08163454555 | 2007-09-01 | L0005 | 1250000 |


0 | cx | com1 |

+-----------+-----------+--------------+-----------------+--------------+------------+-------+---------+-----------+-----------+----
----------+

5 rows in set (0.00 sec)

MariaDB [Perusahaan_Lea]> SELECT idpegawai, namabelakang, gaji FROM pegawai;

+-----------+--------------+---------+

| idpegawai | namabelakang | gaji |

+-----------+--------------+---------+
| E001 | gustiawan | 2000000 |

| E002 | ganiardi | 2000000 |

| E003 | ahmad | 1500000 |

| E004 | bunton | 1500000 |

| E005 | scolf | 1250000 |

+-----------+--------------+---------+

5 rows in set (0.00 sec)

MariaDB [Perusahaan_Lea]>