0% found this document useful (0 votes)
217 views5 pages

Mysql

- The document shows the commands used in MySQL to create and manage databases and tables. It creates a database called "latihan2" and a table called "mhs", later renamed to "mahasiswa". It inserts, updates, and selects data from the table. Several syntax errors are encountered and corrected throughout the process.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
217 views5 pages

Mysql

- The document shows the commands used in MySQL to create and manage databases and tables. It creates a database called "latihan2" and a table called "mhs", later renamed to "mahasiswa". It inserts, updates, and selects data from the table. Several syntax errors are encountered and corrected throughout the process.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

C:\Xampp\mysql\bin>mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 4 Server version: 5.1.33-community MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> show databases -> show databases;\ 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 'show databases' at line 2 mysql> show databases;\ +--------------------+ | Database | +--------------------+ | information_schema | | cdcol | | latihan1 | | lol | | mysql | | phpmyadmin | | test | | wahyu | | webauth | +--------------------+ 9 rows in set (0.00 sec) mysql> create database latihan2; Query OK, 1 row affected (0.00 sec) mysql> show tables; ERROR 1046 (3D000): No database selected mysql> use latihan2; Database changed mysql> show tables;\ Empty set (0.00 sec) mysql> create table mahasiswa -> asdasd -> asdsadas;d'as;d ERROR 1064 (42000): You have an error in corresponds to your MySQL server version d asdsadas' at line 2 '> asdsadas;d'as;dsda ERROR 1064 (42000): You have an error in corresponds to your MySQL server version d asdsadas;d'as' at line 1 -> bgfjhkljgfhjkldfjgkisnj; gk; ERROR 1064 (42000): You have an error in corresponds to your MySQL server version bgfjhkljgfhjkldfjgkisnj' at line 1 ERROR 1064 (42000): You have an error in corresponds to your MySQL server version t line 1 mysql> create table mahasiswa; ERROR 1113 (42000): A table must have at

your SQL syntax; check the manual that for the right syntax to use near 'asdas

your SQL syntax; check the manual that for the right syntax to use near 'd'as;

your SQL syntax; check the manual that for the right syntax to use near 'dsda your SQL syntax; check the manual that for the right syntax to use near 'gk' a least 1 column

mysql> drop latihan1; 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 'latih an1' at line 1 mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | cdcol | | latihan2 | | lol | | mysql | | phpmyadmin | | test | | wahyu | | webauth | +--------------------+ 9 rows in set (0.00 sec) mysql> create table mhs(nim int(10) unsigned auto_increment primary_key ,nama va rchar(50) not null) -> ; 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 'prima ry_key ,nama varchar(50) not null)' at line 1 mysql> create table mhs(nim int(10) unsigned auto_increment primary \key,nama va rchar(50) not null) ERROR: Unknown command '\k'. -> ; 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 '\key, nama varchar(50) not null)' at line 1 mysql> create table mhs(nim int(10) unsigned auto_increment primary key ,nama va rchar(50) not null) -> ; Query OK, 0 rows affected (0.05 sec) mysql> show tables; +--------------------+ | Tables_in_latihan2 | +--------------------+ | mhs | +--------------------+ 1 row in set (0.00 sec) mysql> desc mhs; +-------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+------------------+------+-----+---------+----------------+ | nim | int(10) unsigned | NO | PRI | NULL | auto_increment | | nama | varchar(50) | NO | | NULL | | +-------+------------------+------+-----+---------+----------------+ 2 rows in set (0.00 sec) mysql> alter table mhs -> add jenkel char(2) not null; Query OK, 0 rows affected (0.06 sec) Records: 0 Duplicates: 0 Warnings: 0

mysql> desc mhs; +--------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------+------------------+------+-----+---------+----------------+ | nim | int(10) unsigned | NO | PRI | NULL | auto_increment | | nama | varchar(50) | NO | | NULL | | | jenkel | char(2) | NO | | NULL | | +--------+------------------+------+-----+---------+----------------+ 3 rows in set (0.00 sec) mysql> insert into latihan2.mhs\ -> nim 1007055012 -> nama rizky -> ; 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 'nim 1 007055012 nama rizky' at line 2 mysql> insert into latihan2.mhs -> (nim,nama,jenkel) -> values (1007055012,rizky,LK) -> ; ERROR 1054 (42S22): Unknown column 'rizky' in 'field list' mysql> values (1007055012,'rizky','LK') -> ; 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 'value s (1007055012,'rizky','LK')' at line 1 mysql> show tables; +--------------------+ | Tables_in_latihan2 | +--------------------+ | mhs | +--------------------+ 1 row in set (0.00 sec) mysql> select * from mhs -> ; +-----+------+--------+ | nim | nama | jenkel | +-----+------+--------+ | 1 | | LK | +-----+------+--------+ 1 row in set (0.00 sec) mysql> insert into latihan2.mhs -> (nim,nama,jenkel) -> values (1007055016,'agus','PR'); Query OK, 1 row affected (0.00 sec) mysql> select * from mhs -> ; +------------+-------+--------+ | nim | nama | jenkel | +------------+-------+--------+ | 1 | | LK | | 1007055012 | rizky | | | 1007055016 | agus | PR | +------------+-------+--------+

3 rows in set (0.00 sec) mysql> alter table mhs jenkel jeniskelamin varchar(10) not null; 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 'jenke l jeniskelamin varchar(10) not null' at line 1 mysql> alter table mhs change jenkel jeniskelamin varchar(10) not null; Query OK, 3 rows affected (0.05 sec) Records: 3 Duplicates: 0 Warnings: 0 mysql> select * from mhs; +------------+-------+--------------+ | nim | nama | jeniskelamin | +------------+-------+--------------+ | 1 | | LK | | 1007055012 | rizky | | | 1007055016 | agus | PR | +------------+-------+--------------+ 3 rows in set (0.00 sec) mysql> mysql> update mhs set nim=1007055006 where jeniskelamin='LK'; Query OK, 1 row affected (0.02 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from mhs -> ; +------------+-------+--------------+ | nim | nama | jeniskelamin | +------------+-------+--------------+ | 1007055006 | | LK | | 1007055012 | rizky | | | 1007055016 | agus | PR | +------------+-------+--------------+ 3 rows in set (0.00 sec) mysql> update mhs set nama=testes where nim=1007055006; ERROR 1054 (42S22): Unknown column 'testes' in 'field list' mysql> update mhs set nama='testes' where nim=1007055006; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from mhs -> ; +------------+--------+--------------+ | nim | nama | jeniskelamin | +------------+--------+--------------+ | 1007055006 | testes | LK | | 1007055012 | rizky | | | 1007055016 | agus | PR | +------------+--------+--------------+ 3 rows in set (0.00 sec) mysql> insert into -> (jeniskelamin) -> values (LK); 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 '(jeni skelamin) values (LK)' at line 2

mysql> insert into latihan2.mhs -> (jeniskelamin) -> values (LK); ERROR 1054 (42S22): Unknown column 'LK' in 'field list' mysql> insert into latihan2.mhs -> (jeniskelamin) -> values ('LK'); Query OK, 1 row affected, 1 warning (0.00 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | cdcol | | latihan2 | | lol | | mysql | | phpmyadmin | | test | | wahyu | | webauth | +--------------------+ 9 rows in set (0.00 sec) mysql> drop lol; 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 'lol' at line 1 mysql> drop database lol; Query OK, 3 rows affected (0.02 sec) mysql> drop database wahyu; Query OK, 2 rows affected (0.00 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | cdcol | | latihan2 | | mysql | | phpmyadmin | | test | | webauth | +--------------------+ 7 rows in set (0.00 sec) mysql> rename table mhs -> ('mahasiswa') -> ; 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 '('mah asiswa')' at line 2 mysql> rename table mhs to mahasiswa -> ; Query OK, 0 rows affected (0.00 sec) mysql>

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy