JawabKuis

11
mysql> create database dataku; Query OK, 1 row affected (0.22 sec) mysql> use dataku Database changed mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | dataku | | mysql | | phpmyadmin | | test | +--------------------+ 5 rows in set (0.53 sec) mysql> select database(); +------------+ | database() | +------------+ | dataku | +------------+ 1 row in set (0.00 sec) mysql> create table tblKuis1 (NIM char(9) not null primary key, -> NamaMhs Varchar(25), -> TglLahir date not null default '1989-12-31', -> TB SmallInt(3) Not Null default 155); Query OK, 0 rows affected (0.34 sec) mysql> desc tblKuis1; +----------+-------------+------+-----+------------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+------------+-------+ | NIM | char(9) | NO | PRI | NULL | | | NamaMhs | varchar(25) | YES | | NULL | | | TglLahir | date | NO | | 1989-12-31 | | | TB | smallint(3) | NO | | 155 | | +----------+-------------+------+-----+------------+-------+ 4 rows in set (0.23 sec) mysql> alter table tblkuis1 add BB tinyint(3) unsigned not null default 50; Query OK, 0 rows affected (0.28 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> desc tblKuis1; +----------+---------------------+------+-----+------------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+---------------------+------+-----+------------+-------+ | NIM | char(9) | NO | PRI | NULL | | | NamaMhs | varchar(25) | YES | | NULL | | | TglLahir | date | NO | | 1989-12-31 | | | TB | smallint(3) | NO | | 155 | | | BB | tinyint(3) unsigned | NO | | 50 | | +----------+---------------------+------+-----+------------+-------+ 5 rows in set (0.11 sec) mysql> alter table tblkuis1 change tgllahir Tanggallahir; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that

Transcript of JawabKuis

mysql> create database dataku;Query OK, 1 row affected (0.22 sec)

mysql> use datakuDatabase changedmysql> show databases;+--------------------+| Database |+--------------------+| information_schema | | dataku | | mysql | | phpmyadmin | | test | +--------------------+5 rows in set (0.53 sec)

mysql> select database();+------------+| database() |+------------+| dataku | +------------+1 row in set (0.00 sec)

mysql> create table tblKuis1 (NIM char(9) not null primary key, -> NamaMhs Varchar(25), -> TglLahir date not null default '1989-12-31', -> TB SmallInt(3) Not Null default 155);Query OK, 0 rows affected (0.34 sec)

mysql> desc tblKuis1;+----------+-------------+------+-----+------------+-------+| Field | Type | Null | Key | Default | Extra |+----------+-------------+------+-----+------------+-------+| NIM | char(9) | NO | PRI | NULL | | | NamaMhs | varchar(25) | YES | | NULL | | | TglLahir | date | NO | | 1989-12-31 | | | TB | smallint(3) | NO | | 155 | | +----------+-------------+------+-----+------------+-------+4 rows in set (0.23 sec)

mysql> alter table tblkuis1 add BB tinyint(3) unsigned not null default 50;Query OK, 0 rows affected (0.28 sec)Records: 0 Duplicates: 0 Warnings: 0

mysql> desc tblKuis1;+----------+---------------------+------+-----+------------+-------+| Field | Type | Null | Key | Default | Extra |+----------+---------------------+------+-----+------------+-------+| NIM | char(9) | NO | PRI | NULL | | | NamaMhs | varchar(25) | YES | | NULL | | | TglLahir | date | NO | | 1989-12-31 | | | TB | smallint(3) | NO | | 155 | | | BB | tinyint(3) unsigned | NO | | 50 | | +----------+---------------------+------+-----+------------+-------+5 rows in set (0.11 sec)

mysql> alter table tblkuis1 change tgllahir Tanggallahir;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 1mysql> alter table tblkuis1 change tgllahir Tanggallahir date not null default '1989-12-31';Query OK, 0 rows affected (0.08 sec)Records: 0 Duplicates: 0 Warnings: 0

mysql> desc tblKuis1;+--------------+---------------------+------+-----+------------+-------+| Field | Type | Null | Key | Default | Extra |+--------------+---------------------+------+-----+------------+-------+| NIM | char(9) | NO | PRI | NULL | | | NamaMhs | varchar(25) | YES | | NULL | | | Tanggallahir | date | NO | | 1989-12-31 | | | TB | smallint(3) | NO | | 155 | | | BB | tinyint(3) unsigned | NO | | 50 | | +--------------+---------------------+------+-----+------------+-------+5 rows in set (0.05 sec)

mysql> alter table tblkuis1 rename to tabelKuis1;Query OK, 0 rows affected (0.02 sec)

mysql> show tables;+------------------+| Tables_in_dataku |+------------------+| tabelkuis1 | +------------------+1 row in set (0.03 sec)

mysql> alter table tabelkuis1 rename to tblKuis1;Query OK, 0 rows affected (0.01 sec)

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

mysql> alter table tblkuis1 add JenisKel ENUM('Pria','Wanita') Not NUll before tanggallahir;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 'before tanggallahir' at line 1mysql> alter table tblkuis1 add JenisKel ENUM('Pria','Wanita') Not NUll after NamaMhs;Query OK, 0 rows affected (0.08 sec)Records: 0 Duplicates: 0 Warnings: 0

mysql> desc tblKuis1;+--------------+-----------------------+------+-----+------------+-------+| Field | Type | Null | Key | Default | Extra |+--------------+-----------------------+------+-----+------------+-------+| NIM | char(9) | NO | PRI | NULL | | | NamaMhs | varchar(25) | YES | | NULL | | | JenisKel | enum('Pria','Wanita') | NO | | NULL | | | Tanggallahir | date | NO | | 1989-12-31 | | | TB | smallint(3) | NO | | 155 | |

| BB | tinyint(3) unsigned | NO | | 50 | | +--------------+-----------------------+------+-----+------------+-------+6 rows in set (0.03 sec)

mysql> alter table tblkuis1 modify TB tinyint(3) unsigned not null default 150;Query OK, 0 rows affected (0.11 sec)Records: 0 Duplicates: 0 Warnings: 0

mysql> desc tblKuis1;+--------------+-----------------------+------+-----+------------+-------+| Field | Type | Null | Key | Default | Extra |+--------------+-----------------------+------+-----+------------+-------+| NIM | char(9) | NO | PRI | NULL | | | NamaMhs | varchar(25) | YES | | NULL | | | JenisKel | enum('Pria','Wanita') | NO | | NULL | | | Tanggallahir | date | NO | | 1989-12-31 | | | TB | tinyint(3) unsigned | NO | | 150 | | | BB | tinyint(3) unsigned | NO | | 50 | | +--------------+-----------------------+------+-----+------------+-------+6 rows in set (0.03 sec)

mysql> create table tblKuis2 (NIM char(9) Not Null default not null primary key, -> NamaMhs varchar(25), -> JenisKel ENUM('Pria','Wanita') Not Null default not null, -> TanggalLahir Date Not Null default '1989-12-31', -> TB TinyInt(3) Unsigned Not Null Default 150, -> BB TinyInt(3) Unsigned Not Null Default 50);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 'not null primary key,NamaMhs varchar(25),JenisKel ENUM('Pria','Wanita') Not Nu' at line 1mysql> create table tblKuis2 (NIM char(9) Not Null default not null primary key, -> ;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 'not null primary key,' at line 1mysql> create table tblKuis2 (NIM char(9) Not Null primary key, -> NamaMhs varchar(25), -> JenisKel ENUM('Pria','Wanita') Not Null, -> TanggalLahir Date Not Null default '1989-12-31', -> TB TinyInt(3) Unsigned Not Null Default 150, -> BB TinyInt(3) Unsigned Not Null Default 50);Query OK, 0 rows affected (0.05 sec)

mysql> desc tblkuis2;+--------------+-----------------------+------+-----+------------+-------+| Field | Type | Null | Key | Default | Extra |+--------------+-----------------------+------+-----+------------+-------+| NIM | char(9) | NO | PRI | NULL | | | NamaMhs | varchar(25) | YES | | NULL | | | JenisKel | enum('Pria','Wanita') | NO | | NULL | | | TanggalLahir | date | NO | | 1989-12-31 | | | TB | tinyint(3) unsigned | NO | | 150 | | | BB | tinyint(3) unsigned | NO | | 50 | | +--------------+-----------------------+------+-----+------------+-------+6 rows in set (0.01 sec)

mysql> insert into tblkusi2 values -> ('222070001','Bambang H','Pria','1989-12-13',159,55);

ERROR 1146 (42S02): Table 'dataku.tblkusi2' doesn't existmysql> insert into tblkuis2 values -> ('222070001','Bambang H','Pria','1989-12-13',159,55);Query OK, 1 row affected (0.13 sec)

mysql> select * from tblkuis2;+-----------+-----------+----------+--------------+-----+----+| NIM | NamaMhs | JenisKel | TanggalLahir | TB | BB |+-----------+-----------+----------+--------------+-----+----+| 222070001 | Bambang H | Pria | 1989-12-13 | 159 | 55 | +-----------+-----------+----------+--------------+-----+----+1 row in set (0.02 sec)

mysql> insert into tblkuis2 values -> ('222070002','Sinta D','Wanita','1990-01-18',155,4855), -> ('222070003','Maria S','Wanita','1989-08-23',161,;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 3mysql> insert into tblkuis2 values -> ('222070002','Sinta D','Wanita','1990-01-18',155,48), -> ('222070003','Maria S','Wanita','1989-08-23',161,57), -> ('222070004','Zaenal A','Pria','1990-02-15',165,62), -> ('222070005','Endang R','Wanita','1989-10-03',152,53);Query OK, 4 rows affected (0.00 sec)Records: 4 Duplicates: 0 Warnings: 0

mysql> select * from tblkuis2;+-----------+-----------+----------+--------------+-----+----+| NIM | NamaMhs | JenisKel | TanggalLahir | TB | BB |+-----------+-----------+----------+--------------+-----+----+| 222070001 | Bambang H | Pria | 1989-12-13 | 159 | 55 | | 222070002 | Sinta D | Wanita | 1990-01-18 | 155 | 48 | | 222070003 | Maria S | Wanita | 1989-08-23 | 161 | 57 | | 222070004 | Zaenal A | Pria | 1990-02-15 | 165 | 62 | | 222070005 | Endang R | Wanita | 1989-10-03 | 152 | 53 | +-----------+-----------+----------+--------------+-----+----+5 rows in set (0.00 sec)

mysql> update tblkuis2 set tanggallahir ='1990-10-08' where nim like '222070002';Query OK, 1 row affected (0.20 sec)Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from tblkuis2;+-----------+-----------+----------+--------------+-----+----+| NIM | NamaMhs | JenisKel | TanggalLahir | TB | BB |+-----------+-----------+----------+--------------+-----+----+| 222070001 | Bambang H | Pria | 1989-12-13 | 159 | 55 | | 222070002 | Sinta D | Wanita | 1990-10-08 | 155 | 48 | | 222070003 | Maria S | Wanita | 1989-08-23 | 161 | 57 | | 222070004 | Zaenal A | Pria | 1990-02-15 | 165 | 62 | | 222070005 | Endang R | Wanita | 1989-10-03 | 152 | 53 | +-----------+-----------+----------+--------------+-----+----+5 rows in set (0.00 sec)

mysql> update tblkuis2 set tb=162,bb=58 where nim like '222070001';Query OK, 1 row affected (0.00 sec)Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from tblkuis2;+-----------+-----------+----------+--------------+-----+----+| NIM | NamaMhs | JenisKel | TanggalLahir | TB | BB |+-----------+-----------+----------+--------------+-----+----+| 222070001 | Bambang H | Pria | 1989-12-13 | 162 | 58 | | 222070002 | Sinta D | Wanita | 1990-10-08 | 155 | 48 | | 222070003 | Maria S | Wanita | 1989-08-23 | 161 | 57 | | 222070004 | Zaenal A | Pria | 1990-02-15 | 165 | 62 | | 222070005 | Endang R | Wanita | 1989-10-03 | 152 | 53 | +-----------+-----------+----------+--------------+-----+----+5 rows in set (0.00 sec)

mysql> alter table tblkuis2 add GolDarah ENUM('A','B','AB','O') Not Null Default 'AB' after JenisKel;Query OK, 5 rows affected (0.24 sec)Records: 5 Duplicates: 0 Warnings: 0

mysql> desc tblkuis2;+--------------+------------------------+------+-----+------------+-------+| Field | Type | Null | Key | Default | Extra |+--------------+------------------------+------+-----+------------+-------+| NIM | char(9) | NO | PRI | NULL | | | NamaMhs | varchar(25) | YES | | NULL | | | JenisKel | enum('Pria','Wanita') | NO | | NULL | | | GolDarah | enum('A','B','AB','O') | NO | | AB | | | TanggalLahir | date | NO | | 1989-12-31 | | | TB | tinyint(3) unsigned | NO | | 150 | | | BB | tinyint(3) unsigned | NO | | 50 | | +--------------+------------------------+------+-----+------------+-------+7 rows in set (0.05 sec)

mysql> select * from tblkuis2;+-----------+-----------+----------+----------+--------------+-----+----+| NIM | NamaMhs | JenisKel | GolDarah | TanggalLahir | TB | BB |+-----------+-----------+----------+----------+--------------+-----+----+| 222070001 | Bambang H | Pria | AB | 1989-12-13 | 162 | 58 | | 222070002 | Sinta D | Wanita | AB | 1990-10-08 | 155 | 48 | | 222070003 | Maria S | Wanita | AB | 1989-08-23 | 161 | 57 | | 222070004 | Zaenal A | Pria | AB | 1990-02-15 | 165 | 62 | | 222070005 | Endang R | Wanita | AB | 1989-10-03 | 152 | 53 | +-----------+-----------+----------+----------+--------------+-----+----+5 rows in set (0.02 sec)

mysql> update tblkuis2 set goldarah = 'A' where nim like '222070003';Query OK, 1 row affected (0.00 sec)Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from tblkuis2;+-----------+-----------+----------+----------+--------------+-----+----+| NIM | NamaMhs | JenisKel | GolDarah | TanggalLahir | TB | BB |+-----------+-----------+----------+----------+--------------+-----+----+| 222070001 | Bambang H | Pria | AB | 1989-12-13 | 162 | 58 | | 222070002 | Sinta D | Wanita | AB | 1990-10-08 | 155 | 48 | | 222070003 | Maria S | Wanita | A | 1989-08-23 | 161 | 57 | | 222070004 | Zaenal A | Pria | AB | 1990-02-15 | 165 | 62 | | 222070005 | Endang R | Wanita | AB | 1989-10-03 | 152 | 53 | +-----------+-----------+----------+----------+--------------+-----+----+5 rows in set (0.00 sec)

mysql> update tblkuis2 set goldarah = 'O' where nim like '222070004';

Query OK, 1 row affected (0.00 sec)Rows matched: 1 Changed: 1 Warnings: 0

mysql> select * from tblkuis2;+-----------+-----------+----------+----------+--------------+-----+----+| NIM | NamaMhs | JenisKel | GolDarah | TanggalLahir | TB | BB |+-----------+-----------+----------+----------+--------------+-----+----+| 222070001 | Bambang H | Pria | AB | 1989-12-13 | 162 | 58 | | 222070002 | Sinta D | Wanita | AB | 1990-10-08 | 155 | 48 | | 222070003 | Maria S | Wanita | A | 1989-08-23 | 161 | 57 | | 222070004 | Zaenal A | Pria | O | 1990-02-15 | 165 | 62 | | 222070005 | Endang R | Wanita | AB | 1989-10-03 | 152 | 53 | +-----------+-----------+----------+----------+--------------+-----+----+5 rows in set (0.02 sec)

mysql> insert into tblkuis2 values -> ;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 1mysql> insert into tblkuis2 (NIM,NamaMhs,JenisKel,TanggalLahhir,TB,BB) values -> ('222070006','Muhammad F','Pria','1989-08-21',163,55);ERROR 1054 (42S22): Unknown column 'TanggalLahhir' in 'field list'mysql> insert into tblkuis2 (NIM,NamaMhs,JenisKel,TanggalLahir,TB,BB) values -> ('222070006','Muhammad F','Pria','1989-08-21',163,55);Query OK, 1 row affected (0.00 sec)

mysql> select * from tblkuis2;+-----------+------------+----------+----------+--------------+-----+----+| NIM | NamaMhs | JenisKel | GolDarah | TanggalLahir | TB | BB |+-----------+------------+----------+----------+--------------+-----+----+| 222070001 | Bambang H | Pria | AB | 1989-12-13 | 162 | 58 | | 222070002 | Sinta D | Wanita | AB | 1990-10-08 | 155 | 48 | | 222070003 | Maria S | Wanita | A | 1989-08-23 | 161 | 57 | | 222070004 | Zaenal A | Pria | O | 1990-02-15 | 165 | 62 | | 222070005 | Endang R | Wanita | AB | 1989-10-03 | 152 | 53 | | 222070006 | Muhammad F | Pria | AB | 1989-08-21 | 163 | 55 | +-----------+------------+----------+----------+--------------+-----+----+6 rows in set (0.00 sec)

mysql> select * from tblkuis2 wherejeniskel like 'Wanita' or year(tanggallahir) = 1990;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 'like 'Wanita' or year(tanggallahir) = 1990' at line 1mysql> select * from tblkuis2 where jeniskel like 'Wanita' or year(tanggallahir) = 1990;+-----------+----------+----------+----------+--------------+-----+----+| NIM | NamaMhs | JenisKel | GolDarah | TanggalLahir | TB | BB |+-----------+----------+----------+----------+--------------+-----+----+| 222070002 | Sinta D | Wanita | AB | 1990-10-08 | 155 | 48 | | 222070003 | Maria S | Wanita | A | 1989-08-23 | 161 | 57 | | 222070004 | Zaenal A | Pria | O | 1990-02-15 | 165 | 62 | | 222070005 | Endang R | Wanita | AB | 1989-10-03 | 152 | 53 | +-----------+----------+----------+----------+--------------+-----+----+4 rows in set (0.06 sec)

mysql> create table tblKuis3 (NIM char(9) Not Null primary key, -> NamaMhs varchar(25), -> JenisKel ENUM('Pria','Wanita') Not Null,

-> GolDarah ENUM('A','B','AB','O') Not Null Default 'AB', -> TanggalLahir Date Not Null default '1989-01-01', -> TB TinyInt(3) Unsigned Not Null Default 0, -> BB TinyInt(3) Unsigned Not Null Default 0);Query OK, 0 rows affected (0.05 sec)

mysql> desc tblkuis3;+--------------+------------------------+------+-----+------------+-------+| Field | Type | Null | Key | Default | Extra |+--------------+------------------------+------+-----+------------+-------+| NIM | char(9) | NO | PRI | NULL | | | NamaMhs | varchar(25) | YES | | NULL | | | JenisKel | enum('Pria','Wanita') | NO | | NULL | | | GolDarah | enum('A','B','AB','O') | NO | | AB | | | TanggalLahir | date | NO | | 1989-01-01 | | | TB | tinyint(3) unsigned | NO | | 0 | | | BB | tinyint(3) unsigned | NO | | 0 | | +--------------+------------------------+------+-----+------------+-------+7 rows in set (0.03 sec)

mysql> insert into tblkuis3 values -> ('222070001','Bambang H','Pria','AB','1989-12-13',159,55);Query OK, 1 row affected (0.02 sec)

mysql> select * from tblkuis3;+-----------+-----------+----------+----------+--------------+-----+----+| NIM | NamaMhs | JenisKel | GolDarah | TanggalLahir | TB | BB |+-----------+-----------+----------+----------+--------------+-----+----+| 222070001 | Bambang H | Pria | AB | 1989-12-13 | 159 | 55 | +-----------+-----------+----------+----------+--------------+-----+----+1 row in set (0.00 sec)

mysql> insert into tblkuis3 values -> ('222070002','Sinta D','Wanita','AB','1990-01-18',155,48), -> ('222070003','Maria S','Wanita','A','1989-08-23',161,57), -> ('222070004','Zaenal A','Pria','O','1990-02-15',165,62), -> ('222070005','Endang R','Wanita','AB','1989-10-03',152,53), -> ('222070006','Muhammad F','Pria','','1989-08-21',163,55);Query OK, 5 rows affected, 1 warning (0.02 sec)Records: 5 Duplicates: 0 Warnings: 1

mysql> select * from tblkuis3;+-----------+------------+----------+----------+--------------+-----+----+| NIM | NamaMhs | JenisKel | GolDarah | TanggalLahir | TB | BB |+-----------+------------+----------+----------+--------------+-----+----+| 222070001 | Bambang H | Pria | AB | 1989-12-13 | 159 | 55 | | 222070002 | Sinta D | Wanita | AB | 1990-01-18 | 155 | 48 | | 222070003 | Maria S | Wanita | A | 1989-08-23 | 161 | 57 | | 222070004 | Zaenal A | Pria | O | 1990-02-15 | 165 | 62 | | 222070005 | Endang R | Wanita | AB | 1989-10-03 | 152 | 53 | | 222070006 | Muhammad F | Pria | | 1989-08-21 | 163 | 55 | +-----------+------------+----------+----------+--------------+-----+----+6 rows in set (0.00 sec)

mysql> insert into tblkuis3 values -> ('222070007','Catur Andika','Pria','B','1990-11-05',168,64), -> ('222070005','Indah K','Wanita','A','1989-06-25',156,60), -> ;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 3mysql> insert into tblkuis3 values -> ('222070007','Catur Andika','Pria','B','1990-11-05',168,64), -> ('222070008','Indah K','Wanita','A','1989-06-25',156,60), -> ('222070009','Putra N','Pria','O','1990-03-12',173,69), -> ('222070010','Ernawati','Wanita','B','1989-10-23',153,45);Query OK, 4 rows affected (0.00 sec)Records: 4 Duplicates: 0 Warnings: 0

mysql> select * from tblkuis3;+-----------+--------------+----------+----------+--------------+-----+----+| NIM | NamaMhs | JenisKel | GolDarah | TanggalLahir | TB | BB |+-----------+--------------+----------+----------+--------------+-----+----+| 222070001 | Bambang H | Pria | AB | 1989-12-13 | 159 | 55 | | 222070002 | Sinta D | Wanita | AB | 1990-01-18 | 155 | 48 | | 222070003 | Maria S | Wanita | A | 1989-08-23 | 161 | 57 | | 222070004 | Zaenal A | Pria | O | 1990-02-15 | 165 | 62 | | 222070005 | Endang R | Wanita | AB | 1989-10-03 | 152 | 53 | | 222070006 | Muhammad F | Pria | | 1989-08-21 | 163 | 55 | | 222070007 | Catur Andika | Pria | B | 1990-11-05 | 168 | 64 | | 222070008 | Indah K | Wanita | A | 1989-06-25 | 156 | 60 | | 222070009 | Putra N | Pria | O | 1990-03-12 | 173 | 69 | | 222070010 | Ernawati | Wanita | B | 1989-10-23 | 153 | 45 | +-----------+--------------+----------+----------+--------------+-----+----+10 rows in set (0.00 sec)

mysql> select * from tblkuis3 -> where jeniskel like 'Pria' or goldarah not like 'AB';+-----------+--------------+----------+----------+--------------+-----+----+| NIM | NamaMhs | JenisKel | GolDarah | TanggalLahir | TB | BB |+-----------+--------------+----------+----------+--------------+-----+----+| 222070001 | Bambang H | Pria | AB | 1989-12-13 | 159 | 55 | | 222070003 | Maria S | Wanita | A | 1989-08-23 | 161 | 57 | | 222070004 | Zaenal A | Pria | O | 1990-02-15 | 165 | 62 | | 222070006 | Muhammad F | Pria | | 1989-08-21 | 163 | 55 | | 222070007 | Catur Andika | Pria | B | 1990-11-05 | 168 | 64 | | 222070008 | Indah K | Wanita | A | 1989-06-25 | 156 | 60 | | 222070009 | Putra N | Pria | O | 1990-03-12 | 173 | 69 | | 222070010 | Ernawati | Wanita | B | 1989-10-23 | 153 | 45 | +-----------+--------------+----------+----------+--------------+-----+----+8 rows in set (0.00 sec)

mysql> where jeniskel like 'Pria' and goldarah not like 'AB';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 'where jeniskel like 'Pria' and goldarah not like 'AB'' at line 1mysql> select * from tblkuis3 -> where jeniskel like 'Pria' or goldarah not like 'AB';+-----------+--------------+----------+----------+--------------+-----+----+| NIM | NamaMhs | JenisKel | GolDarah | TanggalLahir | TB | BB |+-----------+--------------+----------+----------+--------------+-----+----+| 222070001 | Bambang H | Pria | AB | 1989-12-13 | 159 | 55 | | 222070003 | Maria S | Wanita | A | 1989-08-23 | 161 | 57 | | 222070004 | Zaenal A | Pria | O | 1990-02-15 | 165 | 62 | | 222070006 | Muhammad F | Pria | | 1989-08-21 | 163 | 55 | | 222070007 | Catur Andika | Pria | B | 1990-11-05 | 168 | 64 | | 222070008 | Indah K | Wanita | A | 1989-06-25 | 156 | 60 | | 222070009 | Putra N | Pria | O | 1990-03-12 | 173 | 69 | | 222070010 | Ernawati | Wanita | B | 1989-10-23 | 153 | 45 | +-----------+--------------+----------+----------+--------------+-----+----+

8 rows in set (0.00 sec)

mysql> mysql> select * from tblkuis3 -> where jeniskel like 'Pria' and goldarah not like 'AB';+-----------+--------------+----------+----------+--------------+-----+----+| NIM | NamaMhs | JenisKel | GolDarah | TanggalLahir | TB | BB |+-----------+--------------+----------+----------+--------------+-----+----+| 222070004 | Zaenal A | Pria | O | 1990-02-15 | 165 | 62 | | 222070006 | Muhammad F | Pria | | 1989-08-21 | 163 | 55 | | 222070007 | Catur Andika | Pria | B | 1990-11-05 | 168 | 64 | | 222070009 | Putra N | Pria | O | 1990-03-12 | 173 | 69 | +-----------+--------------+----------+----------+--------------+-----+----+4 rows in set (0.02 sec)

mysql> select nim, namamhs,tb,bb -> from tblkuis3 -> where tb between 155 and 170 -> order by tb desc;+-----------+--------------+-----+----+| nim | namamhs | tb | bb |+-----------+--------------+-----+----+| 222070007 | Catur Andika | 168 | 64 | | 222070004 | Zaenal A | 165 | 62 | | 222070006 | Muhammad F | 163 | 55 | | 222070003 | Maria S | 161 | 57 | | 222070001 | Bambang H | 159 | 55 | | 222070008 | Indah K | 156 | 60 | | 222070002 | Sinta D | 155 | 48 | +-----------+--------------+-----+----+7 rows in set (0.09 sec)

mysql> select nim, namamhs,tanggallahir,monthname(tanggallahir) BulanLahir -> from tblkuis3 -> ;+-----------+--------------+--------------+------------+| nim | namamhs | tanggallahir | BulanLahir |+-----------+--------------+--------------+------------+| 222070001 | Bambang H | 1989-12-13 | December | | 222070002 | Sinta D | 1990-01-18 | January | | 222070003 | Maria S | 1989-08-23 | August | | 222070004 | Zaenal A | 1990-02-15 | February | | 222070005 | Endang R | 1989-10-03 | October | | 222070006 | Muhammad F | 1989-08-21 | August | | 222070007 | Catur Andika | 1990-11-05 | November | | 222070008 | Indah K | 1989-06-25 | June | | 222070009 | Putra N | 1990-03-12 | March | | 222070010 | Ernawati | 1989-10-23 | October | +-----------+--------------+--------------+------------+10 rows in set (0.11 sec)

mysql> select nim, namamhs,tanggallahir,monthname(tanggallahir) BulanLahir -> from tblkuis3 -> where BulanLahir IN('August','October','December') -> Order by month(tanggallahir);ERROR 1054 (42S22): Unknown column 'BulanLahir' in 'where clause'mysql> select nim, namamhs,tanggallahir,monthname(tanggallahir) BulanLahir -> from tblkuis3 -> where monthname(tanggallahir) IN('August','October','December') -> Order by month(tanggallahir);

+-----------+------------+--------------+------------+| nim | namamhs | tanggallahir | BulanLahir |+-----------+------------+--------------+------------+| 222070003 | Maria S | 1989-08-23 | August | | 222070006 | Muhammad F | 1989-08-21 | August | | 222070005 | Endang R | 1989-10-03 | October | | 222070010 | Ernawati | 1989-10-23 | October | | 222070001 | Bambang H | 1989-12-13 | December | +-----------+------------+--------------+------------+5 rows in set (0.01 sec)

mysql> select distinct monthname(tanggallahir) NamaBlnLahir -> from tblkuis3 -> Order by month(tanggallahir);+--------------+| NamaBlnLahir |+--------------+| January | | February | | March | | June | | August | | October | | November | | December | +--------------+8 rows in set (0.05 sec)

mysql> select * from tblkuis3 -> limit 6,5;+-----------+--------------+----------+----------+--------------+-----+----+| NIM | NamaMhs | JenisKel | GolDarah | TanggalLahir | TB | BB |+-----------+--------------+----------+----------+--------------+-----+----+| 222070007 | Catur Andika | Pria | B | 1990-11-05 | 168 | 64 | | 222070008 | Indah K | Wanita | A | 1989-06-25 | 156 | 60 | | 222070009 | Putra N | Pria | O | 1990-03-12 | 173 | 69 | | 222070010 | Ernawati | Wanita | B | 1989-10-23 | 153 | 45 | +-----------+--------------+----------+----------+--------------+-----+----+4 rows in set (0.01 sec)

mysql> limit 5,5;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 'limit 5,5' at line 1mysql> select * from tblkuis3 -> limit 5,5;+-----------+--------------+----------+----------+--------------+-----+----+| NIM | NamaMhs | JenisKel | GolDarah | TanggalLahir | TB | BB |+-----------+--------------+----------+----------+--------------+-----+----+| 222070006 | Muhammad F | Pria | | 1989-08-21 | 163 | 55 | | 222070007 | Catur Andika | Pria | B | 1990-11-05 | 168 | 64 | | 222070008 | Indah K | Wanita | A | 1989-06-25 | 156 | 60 | | 222070009 | Putra N | Pria | O | 1990-03-12 | 173 | 69 | | 222070010 | Ernawati | Wanita | B | 1989-10-23 | 153 | 45 | +-----------+--------------+----------+----------+--------------+-----+----+5 rows in set (0.02 sec)

mysql> select nim, namamhs,jeniskel,tb,bb,tb-110 Ideal -> from tblkuis3 -> where BB >= (TB - 110) and jeniskel like 'Wanita'

-> order by bb desc;+-----------+----------+----------+-----+----+-------+| nim | namamhs | jeniskel | tb | bb | Ideal |+-----------+----------+----------+-----+----+-------+| 222070008 | Indah K | Wanita | 156 | 60 | 46 | | 222070003 | Maria S | Wanita | 161 | 57 | 51 | | 222070005 | Endang R | Wanita | 152 | 53 | 42 | | 222070002 | Sinta D | Wanita | 155 | 48 | 45 | | 222070010 | Ernawati | Wanita | 153 | 45 | 43 | +-----------+----------+----------+-----+----+-------+5 rows in set (0.01 sec)

mysql> \t