mysql> create database haynanang;
Query OK, 1 row affected
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| cdcol |
| data_servicemobil |
| hanif |
| haynanang |
| information_schema |
| mysql |
| nanang |
| nanangdp |
| performance_schema |
| phpmyadmin |
| si15a2 |
| test |
| uas_150101106 |
| webauth |
+--------------------+
14 rows in set
mysql> use haynanang;
Database changed
mysql> create table bukutamu (No int(4)
Primary Key Auto_Increment, Nama varchar(50),Email varchar(50), Komentar text);
Query OK, 0 rows affected
mysql> Alter table bukutamu Add Telepon
varchar(10) After Email;
Query OK, 0 rows affected
Records: 0
Duplicates: 0 Warnings: 0
mysql> Alter table bukutamu Change
Telepon HP varchar(15);
Query OK, 0 rows affected
Records: 0
Duplicates: 0 Warnings: 0
mysql> Alter table bukutamu Change Drop
HP;
ERROR 1064 : You have an error in your SQL
syntax; check the manual that corresponds to your MariaDB server version for
the right syntax to use near 'Drop HP' at line 1
mysql> Alter table bukutamu Drop HP;
Query OK, 0 rows affected
Records: 0
Duplicates: 0 Warnings: 0
mysql> insert into bukutamu
-> values
-> (",'gombloh,'gombloh@gmail.com','yuh'),
-> (",'alay','alay@gmail.com','uduh'),
-> (",'bayu','bayu@gmail.com','hay'),
-> (",'kemal','kemal@gmail.com','uyur');
Query OK, 2 rows affected
Records: 2
Duplicates: 0 Warnings: 2
mysql> insert into bukutamu
-> values
-> (",'gombloh','gombloh@gmail.com','yuh');
-> s;
-> ';
-> dfghjk;
-> ';
ERROR 1064 : You have an error in your SQL
syntax; check the manual that corresponds to your MariaDB server version for
the right syntax to use near '",'gombloh','gombloh@gmail.com','yuh');
s;
';
dfghjk;
'' at line 5
mysql> insert into bukutamu
-> values
-> ('',gombloh','gombloh@gmail.com','yuh');
-> ('','gombloh','gombloh@gmail.com','yuh');
-> (' ','','deni@gmail.com','oke');
-> ';
ERROR 1064 : You have an error in your SQL
syntax; check the manual that corresponds to your MariaDB server version for
the right syntax to use near '','gombloh@gmail.com','yuh');
('','gombloh','gombloh@gmail.com','yuh');
' at line 5
mysql> insert into bukutamu
-> values
-> (' ','gombloh','gombloh@gmail.com','yuh');
Query OK, 1 row affected
mysql> select Nama, Email from bukutamu;
+---------+-------------------+
| Nama
| Email |
+---------+-------------------+
| alay
| alay@gmail.com |
| kemal
| kemal@gmail.com |
| gombloh | gombloh@gmail.com |
+---------+-------------------+
3 rows in set
mysql> select*from bukutamu;
+----+---------+-------------------+----------+
| No | Nama | Email | Komentar |
+----+---------+-------------------+----------+
| 1
| alay | alay@gmail.com | uduh
|
| 2
| kemal | kemal@gmail.com | uyur
|
| 3
| gombloh | gombloh@gmail.com | yuh
|
+----+---------+-------------------+----------+
3 rows in set
mysql> select distinct nama from
bukutamu;
+---------+
| nama
|
+---------+
| alay
|
| kemal
|
| gombloh |
+---------+
3 rows in set
mysql> select*from bukutamu order by
nama;
+----+---------+-------------------+----------+
| No | Nama | Email | Komentar |
+----+---------+-------------------+----------+
| 1
| alay | alay@gmail.com | uduh
|
| 3
| gombloh | gombloh@gmail.com | yuh
|
| 2
| kemal | kemal@gmail.com | uyur
|
+----+---------+-------------------+----------+
3 rows in set
mysql> select*from bukutamu order by
nama ASC;
+----+---------+-------------------+----------+
| No | Nama | Email | Komentar |
+----+---------+-------------------+----------+
| 1
| alay | alay@gmail.com | uduh
|
| 3
| gombloh | gombloh@gmail.com | yuh
|
| 2
| kemal | kemal@gmail.com | uyur
|
+----+---------+-------------------+----------+
3 rows in set
mysql> select*from bukutamu order by
nama DESC;
+----+---------+-------------------+----------+
| No | Nama | Email | Komentar |
+----+---------+-------------------+----------+
| 2
| kemal | kemal@gmail.com | uyur
|
| 3
| gombloh | gombloh@gmail.com | yuh
|
| 1
| alay | alay@gmail.com | uduh
|
+----+---------+-------------------+----------+
3 rows in set
mysql> select*from bukutamu limit 0,1;
+----+------+----------------+----------+
| No | Nama | Email | Komentar |
+----+------+----------------+----------+
| 1
| alay | alay@gmail.com | uduh |
+----+------+----------------+----------+
1 row in set
mysql> select*from bukutamu limit 0,5;
+----+---------+-------------------+----------+
| No | Nama | Email | Komentar |
+----+---------+-------------------+----------+
| 1
| alay | alay@gmail.com | uduh
|
| 2
| kemal | kemal@gmail.com | uyur
|
| 3
| gombloh | gombloh@gmail.com | yuh
|
+----+---------+-------------------+----------+
3 rows in set
mysql> select*from bukutamu limit 2,5;
+----+---------+-------------------+----------+
| No | Nama | Email | Komentar |
+----+---------+-------------------+----------+
| 3
| gombloh | gombloh@gmail.com | yuh
|
+----+---------+-------------------+----------+
1 row in set
mysql> select*from bukutamu limit 2,3;
+----+---------+-------------------+----------+
| No | Nama | Email | Komentar |
+----+---------+-------------------+----------+
| 3
| gombloh | gombloh@gmail.com | yuh
|
+----+---------+-------------------+----------+
1 row in set
mysql> select*from bukutamu order by no
DESC limit 0,1;
+----+---------+-------------------+----------+
| No | Nama | Email | Komentar |
+----+---------+-------------------+----------+
| 3
| gombloh | gombloh@gmail.com | yuh
|
+----+---------+-------------------+----------+
1 row in set
mysql> select*from bukutamu order by no
limit 0,1;
+----+------+----------------+----------+
| No | Nama | Email | Komentar |
+----+------+----------------+----------+
| 1
| alay | alay@gmail.com | uduh |
+----+------+----------------+----------+
1 row in set
mysql> select*from bukutamu order by
nama limit 0,1;
+----+------+----------------+----------+
| No | Nama | Email | Komentar |
+----+------+----------------+----------+
| 1
| alay | alay@gmail.com | uduh |
+----+------+----------------+----------+
1 row in set
mysql> insert into bukutamu
-> values
-> ('','ita','ita@gmail.com','yuhuuu');
Query OK, 1 row affected
mysql> insert into bukutamu
-> values
-> ('','ani','ani@gmail.com','yuhuuuii'),
-> ('','dewi','dewi@gmail.com','uhukuhuk'),
-> ('','devi','devi@gmail.com','icikiwir');
Query OK, 3 rows affected
Records: 3
Duplicates: 0 Warnings: 3
mysql> select*from bukutamu where nama
like %ita%;
ERROR 1064 : You have an error in your SQL
syntax; check the manual that corresponds to your MariaDB server version for
the right syntax to use near '%ita%' at line 1
mysql> select*from bukutamu where nama
like %ani%;
ERROR 1064 : You have an error in your SQL
syntax; check the manual that corresponds to your MariaDB server version for
the right syntax to use near '%ani%' at line 1
mysql> select*from bukutamu where
nama='ita';
+----+------+---------------+----------+
| No | Nama | Email | Komentar |
+----+------+---------------+----------+
| 4
| ita | ita@gmail.com | yuhuuu |
+----+------+---------------+----------+
1 row in set
mysql> select*from bukutamu where nama
like '%ita%';
+----+------+---------------+----------+
| No | Nama | Email | Komentar |
+----+------+---------------+----------+
| 4
| ita | ita@gmail.com | yuhuuu |
+----+------+---------------+----------+
1 row in set
mysql> select*from bukutamu where nama
like 'ani%';
+----+------+---------------+----------+
| No | Nama | Email | Komentar |
+----+------+---------------+----------+
| 5
| ani | ani@gmail.com | yuhuuuii |
+----+------+---------------+----------+
1 row in set
mysql> select*from bukutamu where nama
like '%ani%';
+----+------+---------------+----------+
| No | Nama | Email | Komentar |
+----+------+---------------+----------+
| 5
| ani | ani@gmail.com | yuhuuuii |
+----+------+---------------+----------+
1 row in set
mysql> select*from bukutamu where nama
like '%ani';
+----+------+---------------+----------+
| No | Nama | Email | Komentar |
+----+------+---------------+----------+
| 5
| ani | ani@gmail.com | yuhuuuii |
+----+------+---------------+----------+
1 row in set
mysql>






0 komentar:
Posting Komentar