SlideShare una empresa de Scribd logo
1 de 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>

Más contenido relacionado

La actualidad más candente

Machine Learning: Generative and Discriminative Models
Machine Learning: Generative and Discriminative ModelsMachine Learning: Generative and Discriminative Models
Machine Learning: Generative and Discriminative Modelsbutest
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexityAnkit Katiyar
 
Lecture 3 insertion sort and complexity analysis
Lecture 3   insertion sort and complexity analysisLecture 3   insertion sort and complexity analysis
Lecture 3 insertion sort and complexity analysisjayavignesh86
 
Comuter graphics ellipse drawing algorithm
Comuter graphics ellipse drawing algorithmComuter graphics ellipse drawing algorithm
Comuter graphics ellipse drawing algorithmRachana Marathe
 
Matrix chain multiplication by MHM
Matrix chain multiplication by MHMMatrix chain multiplication by MHM
Matrix chain multiplication by MHMMd Mosharof Hosen
 
Hotel network scenario implementation
Hotel network scenario implementation Hotel network scenario implementation
Hotel network scenario implementation Home
 
Software Testing & Quality Assurance- Black-Box Testing
Software Testing & Quality Assurance- Black-Box TestingSoftware Testing & Quality Assurance- Black-Box Testing
Software Testing & Quality Assurance- Black-Box TestingMinhas Kamal
 
Biconnected components (13024116056)
Biconnected components (13024116056)Biconnected components (13024116056)
Biconnected components (13024116056)Akshay soni
 
Artificial Neural Networks Lect1: Introduction & neural computation
Artificial Neural Networks Lect1: Introduction & neural computationArtificial Neural Networks Lect1: Introduction & neural computation
Artificial Neural Networks Lect1: Introduction & neural computationMohammed Bennamoun
 
Juniper Srx quickstart-12.1r3
Juniper Srx quickstart-12.1r3Juniper Srx quickstart-12.1r3
Juniper Srx quickstart-12.1r3Mohamed Al-Natour
 
Beginner's Python Cheat Sheet
Beginner's Python Cheat SheetBeginner's Python Cheat Sheet
Beginner's Python Cheat SheetVerxus
 
Cisco ise jun os and ios xr - tacacs+ integration
Cisco ise   jun os and ios xr - tacacs+ integrationCisco ise   jun os and ios xr - tacacs+ integration
Cisco ise jun os and ios xr - tacacs+ integrationArunKumar Subbiah
 
5 Introduction to neural networks
5 Introduction to neural networks5 Introduction to neural networks
5 Introduction to neural networksDmytro Fishman
 
TOC 8 | Derivation, Parse Tree & Ambiguity Check
TOC 8 | Derivation, Parse Tree & Ambiguity CheckTOC 8 | Derivation, Parse Tree & Ambiguity Check
TOC 8 | Derivation, Parse Tree & Ambiguity CheckMohammad Imam Hossain
 
Understanding Feature Space in Machine Learning
Understanding Feature Space in Machine LearningUnderstanding Feature Space in Machine Learning
Understanding Feature Space in Machine LearningAlice Zheng
 
Automata theory -Conversion of ε nfa to nfa
Automata theory -Conversion of ε nfa to nfaAutomata theory -Conversion of ε nfa to nfa
Automata theory -Conversion of ε nfa to nfaAkila Krishnamoorthy
 

La actualidad más candente (20)

Machine Learning: Generative and Discriminative Models
Machine Learning: Generative and Discriminative ModelsMachine Learning: Generative and Discriminative Models
Machine Learning: Generative and Discriminative Models
 
Network management systems in large enterprise
Network management systems in large enterpriseNetwork management systems in large enterprise
Network management systems in large enterprise
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
 
Lecture 3 insertion sort and complexity analysis
Lecture 3   insertion sort and complexity analysisLecture 3   insertion sort and complexity analysis
Lecture 3 insertion sort and complexity analysis
 
Comuter graphics ellipse drawing algorithm
Comuter graphics ellipse drawing algorithmComuter graphics ellipse drawing algorithm
Comuter graphics ellipse drawing algorithm
 
JUNOS: OSPF and BGP
JUNOS: OSPF and BGPJUNOS: OSPF and BGP
JUNOS: OSPF and BGP
 
Matrix chain multiplication by MHM
Matrix chain multiplication by MHMMatrix chain multiplication by MHM
Matrix chain multiplication by MHM
 
Hotel network scenario implementation
Hotel network scenario implementation Hotel network scenario implementation
Hotel network scenario implementation
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
 
Ch04
Ch04Ch04
Ch04
 
Software Testing & Quality Assurance- Black-Box Testing
Software Testing & Quality Assurance- Black-Box TestingSoftware Testing & Quality Assurance- Black-Box Testing
Software Testing & Quality Assurance- Black-Box Testing
 
Biconnected components (13024116056)
Biconnected components (13024116056)Biconnected components (13024116056)
Biconnected components (13024116056)
 
Artificial Neural Networks Lect1: Introduction & neural computation
Artificial Neural Networks Lect1: Introduction & neural computationArtificial Neural Networks Lect1: Introduction & neural computation
Artificial Neural Networks Lect1: Introduction & neural computation
 
Juniper Srx quickstart-12.1r3
Juniper Srx quickstart-12.1r3Juniper Srx quickstart-12.1r3
Juniper Srx quickstart-12.1r3
 
Beginner's Python Cheat Sheet
Beginner's Python Cheat SheetBeginner's Python Cheat Sheet
Beginner's Python Cheat Sheet
 
Cisco ise jun os and ios xr - tacacs+ integration
Cisco ise   jun os and ios xr - tacacs+ integrationCisco ise   jun os and ios xr - tacacs+ integration
Cisco ise jun os and ios xr - tacacs+ integration
 
5 Introduction to neural networks
5 Introduction to neural networks5 Introduction to neural networks
5 Introduction to neural networks
 
TOC 8 | Derivation, Parse Tree & Ambiguity Check
TOC 8 | Derivation, Parse Tree & Ambiguity CheckTOC 8 | Derivation, Parse Tree & Ambiguity Check
TOC 8 | Derivation, Parse Tree & Ambiguity Check
 
Understanding Feature Space in Machine Learning
Understanding Feature Space in Machine LearningUnderstanding Feature Space in Machine Learning
Understanding Feature Space in Machine Learning
 
Automata theory -Conversion of ε nfa to nfa
Automata theory -Conversion of ε nfa to nfaAutomata theory -Conversion of ε nfa to nfa
Automata theory -Conversion of ε nfa to nfa
 

Destacado

Destacado (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
 

Similar a Cat database

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
 

Similar a Cat database (20)

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
 
My sql1
My sql1My sql1
My sql1
 

Último

2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 

Último (20)

2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 

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