SlideShare uma empresa 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>

Mais conteúdo relacionado

Mais procurados

Knapsack problem using dynamic programming
Knapsack problem using dynamic programmingKnapsack problem using dynamic programming
Knapsack problem using dynamic programmingkhush_boo31
 
A presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmA presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmGaurav Kolekar
 
Midpoint circle algo
Midpoint circle algoMidpoint circle algo
Midpoint circle algoMohd Arif
 
Introduction to SSH
Introduction to SSHIntroduction to SSH
Introduction to SSHHemant Shah
 
Bellman Ford's Algorithm
Bellman Ford's AlgorithmBellman Ford's Algorithm
Bellman Ford's AlgorithmTanmay Baranwal
 
Getweeklyhoursbyuser
GetweeklyhoursbyuserGetweeklyhoursbyuser
Getweeklyhoursbyuserhasheemm
 
My lectures circular queue
My lectures circular queueMy lectures circular queue
My lectures circular queueSenthil Kumar
 
3.6 radix sort
3.6 radix sort3.6 radix sort
3.6 radix sortKrish_ver2
 
15 puzzle problem using branch and bound
15 puzzle problem using branch and bound15 puzzle problem using branch and bound
15 puzzle problem using branch and boundAbhishek Singh
 
Birch Algorithm With Solved Example
Birch Algorithm With Solved ExampleBirch Algorithm With Solved Example
Birch Algorithm With Solved Examplekailash shaw
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structureAbrish06
 
Epoll - from the kernel side
Epoll -  from the kernel sideEpoll -  from the kernel side
Epoll - from the kernel sidellj098
 
01 knapsack using backtracking
01 knapsack using backtracking01 knapsack using backtracking
01 knapsack using backtrackingmandlapure
 

Mais procurados (20)

Tsp branch and bound
Tsp branch and boundTsp branch and bound
Tsp branch and bound
 
pushdown automata
pushdown automatapushdown automata
pushdown automata
 
Knapsack problem using dynamic programming
Knapsack problem using dynamic programmingKnapsack problem using dynamic programming
Knapsack problem using dynamic programming
 
A presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithmA presentation on prim's and kruskal's algorithm
A presentation on prim's and kruskal's algorithm
 
Midpoint circle algo
Midpoint circle algoMidpoint circle algo
Midpoint circle algo
 
Time complexity
Time complexityTime complexity
Time complexity
 
Introduction to SSH
Introduction to SSHIntroduction to SSH
Introduction to SSH
 
Bellman Ford's Algorithm
Bellman Ford's AlgorithmBellman Ford's Algorithm
Bellman Ford's Algorithm
 
Disjoint sets
Disjoint setsDisjoint sets
Disjoint sets
 
Computer graphics
Computer graphics   Computer graphics
Computer graphics
 
Getweeklyhoursbyuser
GetweeklyhoursbyuserGetweeklyhoursbyuser
Getweeklyhoursbyuser
 
My lectures circular queue
My lectures circular queueMy lectures circular queue
My lectures circular queue
 
3.6 radix sort
3.6 radix sort3.6 radix sort
3.6 radix sort
 
15 puzzle problem using branch and bound
15 puzzle problem using branch and bound15 puzzle problem using branch and bound
15 puzzle problem using branch and bound
 
Master theorem
Master theoremMaster theorem
Master theorem
 
Fcfs Cpu Scheduling With Gantt Chart
Fcfs Cpu Scheduling With Gantt ChartFcfs Cpu Scheduling With Gantt Chart
Fcfs Cpu Scheduling With Gantt Chart
 
Birch Algorithm With Solved Example
Birch Algorithm With Solved ExampleBirch Algorithm With Solved Example
Birch Algorithm With Solved Example
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structure
 
Epoll - from the kernel side
Epoll -  from the kernel sideEpoll -  from the kernel side
Epoll - from the kernel side
 
01 knapsack using backtracking
01 knapsack using backtracking01 knapsack using backtracking
01 knapsack using backtracking
 

Destaque

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

Semelhante 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
 

Semelhante 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

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
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
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
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
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
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
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
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
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
 
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
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
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
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
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
 

Último (20)

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
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
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
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
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
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
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
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
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
 
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
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
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Ă...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
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
 

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