SlideShare une entreprise Scribd logo
1  sur  6
[root@koneksi ~]# service mysqld start
Starting mysqld:                                           [   OK   ]
[root@koneksi ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.1.67 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| appPegawai         |
| coba               |
| dbpegawai          |
| mysql              |
| test               |
+--------------------+
6 rows in set (0.04 sec)

mysql> create database pbd;
Query OK, 1 row affected (0.00 sec)

mysql> use pbd;
Database changed
mysql> show tables;
Empty set (0.00 sec)

mysql> create table siswa(
    -> id int primary key,
    -> nama varchar(30),
    -> alamat text,
    -> jk char(1));
Query OK, 0 rows affected (0.08 sec)

mysql> show tables;
+---------------+
| Tables_in_pbd |
+---------------+
| siswa         |
+---------------+
1 row in set (0.00 sec)

mysql> desc siswa;
+--------+-------------+------+-----+---------+-------+
| Field | Type         | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------+
| id     | int(11)     | NO   | PRI | NULL    |       |
| nama   | varchar(30) | YES |      | NULL    |       |
| alamat | text        | YES |      | NULL    |       |
| jk     | char(1)     | YES |      | NULL    |       |
+--------+-------------+------+-----+---------+-------+
4 rows in set (0.02 sec)

mysql> insert into siswa(id, nama, alamat, jk)
-> values(1, 'Sapari Andi', 'Mampang', 'L');
Query OK, 1 row affected (0.00 sec)

mysql> insert into siswa(id, nama, alamat, jk)values(1, 'Sapari Andi',
'Mampang', 'L')
    -> ;
ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY'
mysql> insert into siswa(id, nama, alamat, jk)
    -> values (2, 'Dede Hidayat');
ERROR 1136 (21S01): Column count doesn't match value count at row 1
mysql> insert into siswa(id, nama) values (2, 'Dede Hidayat');
Query OK, 1 row affected (0.00 sec)

mysql> show tables;
+---------------+
| Tables_in_pbd |
+---------------+
| siswa         |
+---------------+
1 row in set (0.00 sec)

mysql> desc siswa;
+--------+-------------+------+-----+---------+-------+
| Field | Type         | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------+
| id     | int(11)     | NO   | PRI | NULL    |       |
| nama   | varchar(30) | YES |      | NULL    |       |
| alamat | text        | YES |      | NULL    |       |
| jk     | char(1)     | YES |      | NULL    |       |
+--------+-------------+------+-----+---------+-------+
4 rows in set (0.00 sec)

mysql> select * from siswa;
+----+--------------+---------+------+
| id | nama         | alamat | jk    |
+----+--------------+---------+------+
| 1 | Sapari Andi | Mampang | L      |
| 2 | Dede Hidayat | NULL     | NULL |
+----+--------------+---------+------+
2 rows in set (0.00 sec)

mysql> insert into siswa values(3, 'Heni Lestari', 'Kalibata', 'P');
Query OK, 1 row affected (0.00 sec)

mysql> select nama from siswa;
+--------------+
| nama         |
+--------------+
| Sapari Andi |
| Dede Hidayat |
| Heni Lestari |
+--------------+
3 rows in set (0.00 sec)

mysql> select * from siswa;
+----+--------------+----------+------+
| id | nama         | alamat   | jk   |
+----+--------------+----------+------+
| 1 | Sapari Andi | Mampang | L       |
| 2 | Dede Hidayat | NULL      | NULL |
| 3 | Heni Lestari | Kalibata | P     |
+----+--------------+----------+------+
3 rows in set (0.00 sec)
mysql> update siswa set alamat='Ciamis' where id=2;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from siswa;
+----+--------------+----------+------+
| id | nama         | alamat   | jk   |
+----+--------------+----------+------+
| 1 | Sapari Andi | Mampang | L       |
| 2 | Dede Hidayat | Ciamis    | NULL |
| 3 | Heni Lestari | Kalibata | P     |
+----+--------------+----------+------+
3 rows in set (0.00 sec)

mysql> update siswa set jk='L' where id=2;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from siswa;
+----+--------------+----------+------+
| id | nama         | alamat   | jk   |
+----+--------------+----------+------+
| 1 | Sapari Andi | Mampang | L       |
| 2 | Dede Hidayat | Ciamis    | L    |
| 3 | Heni Lestari | Kalibata | P     |
+----+--------------+----------+------+
3 rows in set (0.00 sec)

mysql> update siswa set jk=1 where jk='P';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from siswa;
+----+--------------+----------+------+
| id | nama         | alamat   | jk   |
+----+--------------+----------+------+
| 1 | Sapari Andi | Mampang | L       |
| 2 | Dede Hidayat | Ciamis    | L    |
| 3 | Heni Lestari | Kalibata | 1     |
+----+--------------+----------+------+
3 rows in set (0.00 sec)

mysql> update siswa set jk=0 where jk='L';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0

mysql> select * from siswa;
+----+--------------+----------+------+
| id | nama         | alamat   | jk   |
+----+--------------+----------+------+
| 1 | Sapari Andi | Mampang | 0       |
| 2 | Dede Hidayat | Ciamis    | 0    |
| 3 | Heni Lestari | Kalibata | 1     |
+----+--------------+----------+------+
3 rows in set (0.00 sec)

mysql> delete from siswa where id=2;
Query OK, 1 row affected (0.00 sec)

mysql> select * from siswa;
+----+--------------+----------+------+
| id | nama         | alamat   | jk   |
+----+--------------+----------+------+
| 1 | Sapari Andi | Mampang | 0       |
| 3 | Heni Lestari | Kalibata | 1     |
+----+--------------+----------+------+
2 rows in set (0.00 sec)

mysql> select * from siswa order by alamat;
+----+--------------+----------+------+
| id | nama         | alamat   | jk   |
+----+--------------+----------+------+
| 3 | Heni Lestari | Kalibata | 1     |
| 1 | Sapari Andi | Mampang | 0       |
+----+--------------+----------+------+
2 rows in set (0.00 sec)

mysql> create table guru(
    -> id int primary key auto_increment,
    -> nama varchar(30),
    -> alamat text,
    -> gaji double);
Query OK, 0 rows affected (0.06 sec)

mysql> insert into guru(nama,alamat,gaji)
    -> values('Karim Santoso','Pancoran',8000000);
Query OK, 1 row affected (0.00 sec)

mysql> select * from guru;
+----+---------------+----------+---------+
| id | nama          | alamat   | gaji    |
+----+---------------+----------+---------+
| 1 | Karim Santoso | Pancoran | 8000000 |
+----+---------------+----------+---------+
1 row in set (0.00 sec)

mysql> desc guru;
+--------+-------------+------+-----+---------+----------------+
| Field | Type         | Null | Key | Default | Extra          |
+--------+-------------+------+-----+---------+----------------+
| id     | int(11)     | NO   | PRI | NULL    | auto_increment |
| nama   | varchar(30) | YES |      | NULL    |                |
| alamat | text        | YES |      | NULL    |                |
| gaji   | double      | YES |      | NULL    |                |
+--------+-------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

mysql> create table mahasiswa(
    -> npm int primary key auto_increment,
    -> nama varchar(30),
    -> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '' at
line 3
mysql> show tables;
+---------------+
| Tables_in_pbd |
+---------------+
| guru          |
| siswa         |
+---------------+
2 rows in set (0.00 sec)

mysql> create table mahasiswa(
    -> npm int primary key auto_increment,
    -> nama varchar(30));
Query OK, 0 rows affected (0.06 sec)
mysql> create table matakuliah(
    -> kodemk int primary key,
    -> mk varchar(30));
Query OK, 0 rows affected (0.06 sec)

mysql> create table krs(
    -> npm int,
    -> ta int,
    -> semester char(1),
    -> kodemk int);
Query OK, 0 rows affected (0.07 sec)

mysql> show tables;
+---------------+
| Tables_in_pbd |
+---------------+
| guru          |
| krs           |
| mahasiswa     |
| matakuliah    |
| siswa         |
+---------------+
5 rows in set (0.00 sec)

mysql> desc pbd;
ERROR 1146 (42S02): Table 'pbd.pbd' doesn't exist
mysql> show tables;
+---------------+
| Tables_in_pbd |
+---------------+
| guru           |
| krs            |
| mahasiswa      |
| matakuliah     |
| siswa          |
+---------------+
5 rows in set (0.00 sec)

mysql> desc krs;
+----------+---------+------+-----+---------+-------+
| Field    | Type    | Null | Key | Default | Extra |
+----------+---------+------+-----+---------+-------+
| npm      | int(11) | YES |      | NULL    |       |
| ta       | int(11) | YES |      | NULL    |       |
| semester | char(1) | YES |      | NULL    |       |
| kodemk   | int(11) | YES |      | NULL    |       |
+----------+---------+------+-----+---------+-------+
4 rows in set (0.00 sec)

mysql> desc mahasiswa;
+-------+-------------+------+-----+---------+----------------+
| Field | Type         | Null | Key | Default | Extra          |
+-------+-------------+------+-----+---------+----------------+
| npm   | int(11)      | NO   | PRI | NULL    | auto_increment |
| nama | varchar(30) | YES |        | NULL    |                |
+-------+-------------+------+-----+---------+----------------+
2 rows in set (0.00 sec)

mysql> desc matakuliah;
+--------+-------------+------+-----+---------+-------+
| Field | Type          | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------+
| kodemk | int(11)      | NO   | PRI | NULL    |       |
| mk     | varchar(30) | YES |       | NULL    |       |
+--------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

mysql>

Contenu connexe

Tendances

5G Technology Tutorial
5G Technology Tutorial5G Technology Tutorial
5G Technology TutorialAPNIC
 
CCNAv5 - S1: Chapter 9 - Subnetting Ip Networks
CCNAv5 - S1: Chapter 9 - Subnetting Ip NetworksCCNAv5 - S1: Chapter 9 - Subnetting Ip Networks
CCNAv5 - S1: Chapter 9 - Subnetting Ip NetworksVuz Dở Hơi
 
3 g event description
3 g event description3 g event description
3 g event descriptionSaif Haider
 
Unit 1 introduction to computer networks
Unit 1  introduction to computer networksUnit 1  introduction to computer networks
Unit 1 introduction to computer networkspavan kumar Thatikonda
 
Ericsson technical interview questions
Ericsson technical interview questionsEricsson technical interview questions
Ericsson technical interview questionssethshivam75
 
VoLTE KPI Performance
VoLTE KPI PerformanceVoLTE KPI Performance
VoLTE KPI PerformanceVikas Shokeen
 
RET configuration .ppt
RET configuration .pptRET configuration .ppt
RET configuration .pptRakeshPanda48
 
CCNA 200-301 Chapter 3-Fundamentals of WANs and IP Routing.pptx
CCNA 200-301 Chapter 3-Fundamentals of WANs and IP Routing.pptxCCNA 200-301 Chapter 3-Fundamentals of WANs and IP Routing.pptx
CCNA 200-301 Chapter 3-Fundamentals of WANs and IP Routing.pptxBabarYunus1
 
Mutual exclusion in distributed systems
Mutual exclusion in distributed systemsMutual exclusion in distributed systems
Mutual exclusion in distributed systemsAJAY KHARAT
 
SGSN- serving gprs support node - Platform - HW, SW and CLI
SGSN- serving gprs support node  - Platform - HW, SW and CLI SGSN- serving gprs support node  - Platform - HW, SW and CLI
SGSN- serving gprs support node - Platform - HW, SW and CLI Mustafa Golam
 
Introduction to network
Introduction to networkIntroduction to network
Introduction to networkDhani Ahmad
 
Topic : X.25, Frame relay and ATM
Topic :  X.25, Frame relay and ATMTopic :  X.25, Frame relay and ATM
Topic : X.25, Frame relay and ATMDr Rajiv Srivastava
 
cấu hình access rule ISA 2006
cấu hình access rule ISA 2006cấu hình access rule ISA 2006
cấu hình access rule ISA 2006vuhosking
 

Tendances (20)

5G Technology Tutorial
5G Technology Tutorial5G Technology Tutorial
5G Technology Tutorial
 
CCNAv5 - S1: Chapter 9 - Subnetting Ip Networks
CCNAv5 - S1: Chapter 9 - Subnetting Ip NetworksCCNAv5 - S1: Chapter 9 - Subnetting Ip Networks
CCNAv5 - S1: Chapter 9 - Subnetting Ip Networks
 
3 g event description
3 g event description3 g event description
3 g event description
 
CS8601 MOBILE COMPUTING
CS8601	MOBILE COMPUTING CS8601	MOBILE COMPUTING
CS8601 MOBILE COMPUTING
 
Unit 1 introduction to computer networks
Unit 1  introduction to computer networksUnit 1  introduction to computer networks
Unit 1 introduction to computer networks
 
Ericsson technical interview questions
Ericsson technical interview questionsEricsson technical interview questions
Ericsson technical interview questions
 
Xcap post processing tool
Xcap post processing toolXcap post processing tool
Xcap post processing tool
 
huawei doc
huawei dochuawei doc
huawei doc
 
Mobile Transport layer
Mobile Transport layerMobile Transport layer
Mobile Transport layer
 
VoLTE KPI Performance
VoLTE KPI PerformanceVoLTE KPI Performance
VoLTE KPI Performance
 
Mobile computing (Wireless) Medium Access Control (MAC)
Mobile computing (Wireless) Medium Access Control (MAC)Mobile computing (Wireless) Medium Access Control (MAC)
Mobile computing (Wireless) Medium Access Control (MAC)
 
RET configuration .ppt
RET configuration .pptRET configuration .ppt
RET configuration .ppt
 
CCNA 200-301 Chapter 3-Fundamentals of WANs and IP Routing.pptx
CCNA 200-301 Chapter 3-Fundamentals of WANs and IP Routing.pptxCCNA 200-301 Chapter 3-Fundamentals of WANs and IP Routing.pptx
CCNA 200-301 Chapter 3-Fundamentals of WANs and IP Routing.pptx
 
Mutual exclusion in distributed systems
Mutual exclusion in distributed systemsMutual exclusion in distributed systems
Mutual exclusion in distributed systems
 
SGSN- serving gprs support node - Platform - HW, SW and CLI
SGSN- serving gprs support node  - Platform - HW, SW and CLI SGSN- serving gprs support node  - Platform - HW, SW and CLI
SGSN- serving gprs support node - Platform - HW, SW and CLI
 
Introduction to network
Introduction to networkIntroduction to network
Introduction to network
 
Enm cli
Enm cliEnm cli
Enm cli
 
Topic : X.25, Frame relay and ATM
Topic :  X.25, Frame relay and ATMTopic :  X.25, Frame relay and ATM
Topic : X.25, Frame relay and ATM
 
cấu hình access rule ISA 2006
cấu hình access rule ISA 2006cấu hình access rule ISA 2006
cấu hình access rule ISA 2006
 
Wireless lan
Wireless lanWireless lan
Wireless lan
 

En vedette

En vedette (9)

Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Twitterplug
TwitterplugTwitterplug
Twitterplug
 
RSpec
RSpecRSpec
RSpec
 
Uninstall ShhMBP
Uninstall ShhMBPUninstall ShhMBP
Uninstall ShhMBP
 
Explicar a Crise
 Explicar a Crise Explicar a Crise
Explicar a Crise
 
Para vane
Para vanePara vane
Para vane
 
World generation final
World generation finalWorld generation final
World generation final
 
Backstopper 3-D Dodgeball
Backstopper 3-D DodgeballBackstopper 3-D Dodgeball
Backstopper 3-D Dodgeball
 
Format Cover Tugas Observasi Lapangan
Format  Cover Tugas Observasi LapanganFormat  Cover Tugas Observasi Lapangan
Format Cover Tugas Observasi Lapangan
 

Similaire à Cat database

Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
 Design and Develop SQL DDL statements which demonstrate the use of SQL objec... Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
Design and Develop SQL DDL statements which demonstrate the use of SQL objec...bhavesh lande
 
Applied Partitioning And Scaling Your Database System Presentation
Applied Partitioning And Scaling Your Database System PresentationApplied Partitioning And Scaling Your Database System Presentation
Applied Partitioning And Scaling Your Database System PresentationRichard Crowley
 
MySQL Kitchen : spice up your everyday SQL queries
MySQL Kitchen : spice up your everyday SQL queriesMySQL Kitchen : spice up your everyday SQL queries
MySQL Kitchen : spice up your everyday SQL queriesDamien Seguy
 
අරුණ හේරත්_MYSQL සිංහල_TL_I_033__techlogiclk.com.pdf
අරුණ හේරත්_MYSQL සිංහල_TL_I_033__techlogiclk.com.pdfඅරුණ හේරත්_MYSQL සිංහල_TL_I_033__techlogiclk.com.pdf
අරුණ හේරත්_MYSQL සිංහල_TL_I_033__techlogiclk.com.pdfAnilManage
 
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)Tesora
 
MySQL Idiosyncrasies That Bite SF
MySQL Idiosyncrasies That Bite SFMySQL Idiosyncrasies That Bite SF
MySQL Idiosyncrasies That Bite SFRonald Bradford
 
Optimizing Queries Using Window Functions
Optimizing Queries Using Window FunctionsOptimizing Queries Using Window Functions
Optimizing Queries Using Window FunctionsI Goo Lee
 
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018teachersduniya.com
 
Modern query optimisation features in MySQL 8.
Modern query optimisation features in MySQL 8.Modern query optimisation features in MySQL 8.
Modern query optimisation features in MySQL 8.Mydbops
 
Mysqlfunctions
MysqlfunctionsMysqlfunctions
MysqlfunctionsN13M
 
My sql statements by okello erick
My sql statements by okello erickMy sql statements by okello erick
My sql statements by okello erickokelloerick
 
MySQL Idiosyncrasies That Bite 2010.07
MySQL Idiosyncrasies That Bite 2010.07MySQL Idiosyncrasies That Bite 2010.07
MySQL Idiosyncrasies That Bite 2010.07Ronald Bradford
 
MySQL Idiosyncrasies That Bite
MySQL Idiosyncrasies That BiteMySQL Idiosyncrasies That Bite
MySQL Idiosyncrasies That BiteRonald Bradford
 

Similaire à Cat database (20)

Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
 Design and Develop SQL DDL statements which demonstrate the use of SQL objec... Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
Design and Develop SQL DDL statements which demonstrate the use of SQL objec...
 
Mysql basics1
Mysql basics1Mysql basics1
Mysql basics1
 
Hanya contoh saja dari xampp
Hanya contoh saja dari xamppHanya contoh saja dari xampp
Hanya contoh saja dari xampp
 
Applied Partitioning And Scaling Your Database System Presentation
Applied Partitioning And Scaling Your Database System PresentationApplied Partitioning And Scaling Your Database System Presentation
Applied Partitioning And Scaling Your Database System Presentation
 
MySQL Kitchen : spice up your everyday SQL queries
MySQL Kitchen : spice up your everyday SQL queriesMySQL Kitchen : spice up your everyday SQL queries
MySQL Kitchen : spice up your everyday SQL queries
 
MySQL SQL Tutorial
MySQL SQL TutorialMySQL SQL Tutorial
MySQL SQL Tutorial
 
My SQL
My SQLMy SQL
My SQL
 
අරුණ හේරත්_MYSQL සිංහල_TL_I_033__techlogiclk.com.pdf
අරුණ හේරත්_MYSQL සිංහල_TL_I_033__techlogiclk.com.pdfඅරුණ හේරත්_MYSQL සිංහල_TL_I_033__techlogiclk.com.pdf
අරුණ හේරත්_MYSQL සිංහල_TL_I_033__techlogiclk.com.pdf
 
Explain
ExplainExplain
Explain
 
Tugas praktikum smbd
Tugas praktikum smbdTugas praktikum smbd
Tugas praktikum smbd
 
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
 
MySQL Idiosyncrasies That Bite SF
MySQL Idiosyncrasies That Bite SFMySQL Idiosyncrasies That Bite SF
MySQL Idiosyncrasies That Bite SF
 
Empresa completo
Empresa completoEmpresa completo
Empresa completo
 
Optimizing Queries Using Window Functions
Optimizing Queries Using Window FunctionsOptimizing Queries Using Window Functions
Optimizing Queries Using Window Functions
 
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
DATA BASE || INTRODUCTION OF DATABASE \\ SQL 2018
 
Modern query optimisation features in MySQL 8.
Modern query optimisation features in MySQL 8.Modern query optimisation features in MySQL 8.
Modern query optimisation features in MySQL 8.
 
Mysqlfunctions
MysqlfunctionsMysqlfunctions
Mysqlfunctions
 
My sql statements by okello erick
My sql statements by okello erickMy sql statements by okello erick
My sql statements by okello erick
 
MySQL Idiosyncrasies That Bite 2010.07
MySQL Idiosyncrasies That Bite 2010.07MySQL Idiosyncrasies That Bite 2010.07
MySQL Idiosyncrasies That Bite 2010.07
 
MySQL Idiosyncrasies That Bite
MySQL Idiosyncrasies That BiteMySQL Idiosyncrasies That Bite
MySQL Idiosyncrasies That Bite
 

Dernier

Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvRicaMaeCastro1
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleCeline George
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 

Dernier (20)

Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP Module
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 

Cat database

  • 1. [root@koneksi ~]# service mysqld start Starting mysqld: [ OK ] [root@koneksi ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 2 Server version: 5.1.67 Source distribution Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | appPegawai | | coba | | dbpegawai | | mysql | | test | +--------------------+ 6 rows in set (0.04 sec) mysql> create database pbd; Query OK, 1 row affected (0.00 sec) mysql> use pbd; Database changed mysql> show tables; Empty set (0.00 sec) mysql> create table siswa( -> id int primary key, -> nama varchar(30), -> alamat text, -> jk char(1)); Query OK, 0 rows affected (0.08 sec) mysql> show tables; +---------------+ | Tables_in_pbd | +---------------+ | siswa | +---------------+ 1 row in set (0.00 sec) mysql> desc siswa; +--------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+-------------+------+-----+---------+-------+ | id | int(11) | NO | PRI | NULL | | | nama | varchar(30) | YES | | NULL | | | alamat | text | YES | | NULL | | | jk | char(1) | YES | | NULL | | +--------+-------------+------+-----+---------+-------+ 4 rows in set (0.02 sec) mysql> insert into siswa(id, nama, alamat, jk)
  • 2. -> values(1, 'Sapari Andi', 'Mampang', 'L'); Query OK, 1 row affected (0.00 sec) mysql> insert into siswa(id, nama, alamat, jk)values(1, 'Sapari Andi', 'Mampang', 'L') -> ; ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY' mysql> insert into siswa(id, nama, alamat, jk) -> values (2, 'Dede Hidayat'); ERROR 1136 (21S01): Column count doesn't match value count at row 1 mysql> insert into siswa(id, nama) values (2, 'Dede Hidayat'); Query OK, 1 row affected (0.00 sec) mysql> show tables; +---------------+ | Tables_in_pbd | +---------------+ | siswa | +---------------+ 1 row in set (0.00 sec) mysql> desc siswa; +--------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+-------------+------+-----+---------+-------+ | id | int(11) | NO | PRI | NULL | | | nama | varchar(30) | YES | | NULL | | | alamat | text | YES | | NULL | | | jk | char(1) | YES | | NULL | | +--------+-------------+------+-----+---------+-------+ 4 rows in set (0.00 sec) mysql> select * from siswa; +----+--------------+---------+------+ | id | nama | alamat | jk | +----+--------------+---------+------+ | 1 | Sapari Andi | Mampang | L | | 2 | Dede Hidayat | NULL | NULL | +----+--------------+---------+------+ 2 rows in set (0.00 sec) mysql> insert into siswa values(3, 'Heni Lestari', 'Kalibata', 'P'); Query OK, 1 row affected (0.00 sec) mysql> select nama from siswa; +--------------+ | nama | +--------------+ | Sapari Andi | | Dede Hidayat | | Heni Lestari | +--------------+ 3 rows in set (0.00 sec) mysql> select * from siswa; +----+--------------+----------+------+ | id | nama | alamat | jk | +----+--------------+----------+------+ | 1 | Sapari Andi | Mampang | L | | 2 | Dede Hidayat | NULL | NULL | | 3 | Heni Lestari | Kalibata | P | +----+--------------+----------+------+ 3 rows in set (0.00 sec)
  • 3. mysql> update siswa set alamat='Ciamis' where id=2; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from siswa; +----+--------------+----------+------+ | id | nama | alamat | jk | +----+--------------+----------+------+ | 1 | Sapari Andi | Mampang | L | | 2 | Dede Hidayat | Ciamis | NULL | | 3 | Heni Lestari | Kalibata | P | +----+--------------+----------+------+ 3 rows in set (0.00 sec) mysql> update siswa set jk='L' where id=2; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from siswa; +----+--------------+----------+------+ | id | nama | alamat | jk | +----+--------------+----------+------+ | 1 | Sapari Andi | Mampang | L | | 2 | Dede Hidayat | Ciamis | L | | 3 | Heni Lestari | Kalibata | P | +----+--------------+----------+------+ 3 rows in set (0.00 sec) mysql> update siswa set jk=1 where jk='P'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from siswa; +----+--------------+----------+------+ | id | nama | alamat | jk | +----+--------------+----------+------+ | 1 | Sapari Andi | Mampang | L | | 2 | Dede Hidayat | Ciamis | L | | 3 | Heni Lestari | Kalibata | 1 | +----+--------------+----------+------+ 3 rows in set (0.00 sec) mysql> update siswa set jk=0 where jk='L'; Query OK, 2 rows affected (0.00 sec) Rows matched: 2 Changed: 2 Warnings: 0 mysql> select * from siswa; +----+--------------+----------+------+ | id | nama | alamat | jk | +----+--------------+----------+------+ | 1 | Sapari Andi | Mampang | 0 | | 2 | Dede Hidayat | Ciamis | 0 | | 3 | Heni Lestari | Kalibata | 1 | +----+--------------+----------+------+ 3 rows in set (0.00 sec) mysql> delete from siswa where id=2; Query OK, 1 row affected (0.00 sec) mysql> select * from siswa; +----+--------------+----------+------+ | id | nama | alamat | jk | +----+--------------+----------+------+ | 1 | Sapari Andi | Mampang | 0 |
  • 4. | 3 | Heni Lestari | Kalibata | 1 | +----+--------------+----------+------+ 2 rows in set (0.00 sec) mysql> select * from siswa order by alamat; +----+--------------+----------+------+ | id | nama | alamat | jk | +----+--------------+----------+------+ | 3 | Heni Lestari | Kalibata | 1 | | 1 | Sapari Andi | Mampang | 0 | +----+--------------+----------+------+ 2 rows in set (0.00 sec) mysql> create table guru( -> id int primary key auto_increment, -> nama varchar(30), -> alamat text, -> gaji double); Query OK, 0 rows affected (0.06 sec) mysql> insert into guru(nama,alamat,gaji) -> values('Karim Santoso','Pancoran',8000000); Query OK, 1 row affected (0.00 sec) mysql> select * from guru; +----+---------------+----------+---------+ | id | nama | alamat | gaji | +----+---------------+----------+---------+ | 1 | Karim Santoso | Pancoran | 8000000 | +----+---------------+----------+---------+ 1 row in set (0.00 sec) mysql> desc guru; +--------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | nama | varchar(30) | YES | | NULL | | | alamat | text | YES | | NULL | | | gaji | double | YES | | NULL | | +--------+-------------+------+-----+---------+----------------+ 4 rows in set (0.00 sec) mysql> create table mahasiswa( -> npm int primary key auto_increment, -> nama varchar(30), -> ; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3 mysql> show tables; +---------------+ | Tables_in_pbd | +---------------+ | guru | | siswa | +---------------+ 2 rows in set (0.00 sec) mysql> create table mahasiswa( -> npm int primary key auto_increment, -> nama varchar(30)); Query OK, 0 rows affected (0.06 sec)
  • 5. mysql> create table matakuliah( -> kodemk int primary key, -> mk varchar(30)); Query OK, 0 rows affected (0.06 sec) mysql> create table krs( -> npm int, -> ta int, -> semester char(1), -> kodemk int); Query OK, 0 rows affected (0.07 sec) mysql> show tables; +---------------+ | Tables_in_pbd | +---------------+ | guru | | krs | | mahasiswa | | matakuliah | | siswa | +---------------+ 5 rows in set (0.00 sec) mysql> desc pbd; ERROR 1146 (42S02): Table 'pbd.pbd' doesn't exist mysql> show tables; +---------------+ | Tables_in_pbd | +---------------+ | guru | | krs | | mahasiswa | | matakuliah | | siswa | +---------------+ 5 rows in set (0.00 sec) mysql> desc krs; +----------+---------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+---------+------+-----+---------+-------+ | npm | int(11) | YES | | NULL | | | ta | int(11) | YES | | NULL | | | semester | char(1) | YES | | NULL | | | kodemk | int(11) | YES | | NULL | | +----------+---------+------+-----+---------+-------+ 4 rows in set (0.00 sec) mysql> desc mahasiswa; +-------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+----------------+ | npm | int(11) | NO | PRI | NULL | auto_increment | | nama | varchar(30) | YES | | NULL | | +-------+-------------+------+-----+---------+----------------+ 2 rows in set (0.00 sec) mysql> desc matakuliah; +--------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+-------------+------+-----+---------+-------+ | kodemk | int(11) | NO | PRI | NULL | | | mk | varchar(30) | YES | | NULL | |