Professional Documents
Culture Documents
1. CREATE
CREATE DATABASE produk
CREATE TABLE IF NOT EXISTS `tblproduk` (
`NIPR` varchar(15) NOT NULL,
`Nama` varchar(30) NOT NULL,
`Tipe` varchar(30) NOT NULL,
`Garansi` varchar(30) NOT NULL,
`Core!` varchar(30) NOT NULL,
`Jenis` text NOT NULL,
PRIMARY KEY (`NIPR`))
CREATE TABLE IF NOT EXISTS `tblsupp` (
`Id` int(5) NOT NULL AUTO_INCREMENT,
`Suppname` varchar(15) NOT NULL,
`Telpon` varchar(15) NOT NULL,
`NIPR` varchar(15) NOT NULL,
PRIMARY KEY (`Id`))
2. INSERT
INSERT INTO `tblproduk` (`NIPR`, `Nama`, `Jenis`,’Tipe’,’Garansi’,’Core!’) VALUES
o ('101', 'Asus Pro', 'Laptop'),
o ('102', 'Lenovo', 'Laptop'),
o ('103', 'Acer', 'Laptop'),
o ('104', 'Dell', 'Laptop'),
o ('201', 'Samsung', 'Handphone'),
o ('202', 'Oppo', 'Handphone'),
o ('203', 'Vivo', 'Handphone'),
o ('204', 'Xiaomi', 'Handphone'),
o ('301', 'Sony', 'Camera'),
o ('302', 'Kodak', 'Camera'),
o ('303', 'Casio', 'Camera'),
o ('401', 'HP', 'Printer'),
o ('402', 'Epson', 'Printer');
INSERT INTO `tblsupp` (`Id`, `suppname`, `NIPR`,’Telpon’) VALUES
3. UPDATE
SELECT * FROM tblproduk;
UPDATE tblproduk SET Nama = 'Samsung'
WHERE Nama ='Asus Pro'
Select * FROM tblsupp;
SELECT * FROM tblsupp;
UPDATE tblsupp SET NIPR = '106'
WHERE NIPR = '101
4. DELETE
DELETE FROM `tblsupp` WHERE NIPR='402'
DELETE FROM `tblproduk` WHERE Nama='Epson'
SusterPasionis@LAPTOP-BAJUJ3UJ c:\xampp 23
# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 22
Server version: 10.4.27-MariaDB mariadb.org binary distribution
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database mahasiswa;
Query OK, 1 row affected (0.013 sec)
SusterPasionis@LAPTOP-BAJUJ3UJ c:\xampp 23
# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 30
Server version: 10.4.27-MariaDB mariadb.org binary distribution
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [mahasiswa]>
Setting environment for using XAMPP for Windows.
SusterPasionis@LAPTOP-BAJUJ3UJ c:\xampp 23
# myql -u root -p
'myql' is not recognized as an internal or external command,
operable program or batch file.
SusterPasionis@LAPTOP-BAJUJ3UJ c:\xampp 23
# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 22
Server version: 10.4.27-MariaDB mariadb.org binary distribution
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
SusterPasionis@LAPTOP-BAJUJ3UJ c:\xampp 23
# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 30
Server version: 10.4.27-MariaDB mariadb.org binary distribution
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [mahasiswa]>