Senin, 10 September 2012

0 Database ; PHP & MYSQL

MEMUNCULKAN DATABASE MYSQL DALAM BENTUK TABLE MENGGUNAKAN PHP..


<?php
include "config.php";
$no = 1;
$sql = "SELECT * from stasiun";
$hasil = mysql_query($sql) or die (mysql_error());
$cekdata = mysql_num_rows($hasil);
if ($hasil==0) {
    echo "data tidak ada";
    }
    else {
    echo "<table border='1' cellspacing=0 cellpadding=0 width=80%>
<tr>
<th scope=col> <abbr=No class=nobg>No</th>
<th scope=col> NAMA_STASIUN RADIO </th>
<th scope=col> ALAMAT </th>
<th scope=col> FREKUENSI</th>
</tr>";

while ($stasiun = mysql_fetch_array($hasil))
    {
    echo "<tr>";
    echo "<td scope=row class=spec align=center>".$no++."</td>";
    echo "<td>" . $stasiun['Nama'] . "</td>";
    echo "<td>" . $stasiun['Alamat'] . "</td>";
    echo "<td>" . $stasiun['Frekuensi'] . "</td>";
    echo "</tr>";
    }
echo "</table>";

}
mysql_close();
?>

0 Tugas Alter table; Radio

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\pcs31>cd\xampp\mysql\bin

C:\xampp\mysql\bin>dor/
'dor' is not recognized as an internal or external command,
operable program or batch file.

C:\xampp\mysql\bin>dir/
Invalid switch - "".

C:\xampp\mysql\bin>dir/w
 Volume in drive C has no label.
 Volume Serial Number is 3837-CD8F

 Directory of C:\xampp\mysql\bin

[.]                     [..]                    bug25714.exe
comp_err.exe            echo.exe                libmysql.dll
my.ini                  myisamchk.exe           myisamlog.exe
myisampack.exe          myisam_ftdump.exe       mysql.exe
mysqladmin.exe          mysqlbinlog.exe         mysqlcheck.exe
mysqld.exe              mysqldump.exe           mysqlimport.exe
mysqlmanager.exe        mysqlshow.exe           mysqlslap.exe
mysqltest.exe           mysql_client_test.exe   mysql_config.bat
mysql_config.pl         mysql_upgrade.exe       my_print_defaults.exe
perror.exe              replace.exe             resolveip.exe
              28 File(s)     42.888.587 bytes
               2 Dir(s)  55.463.063.552 bytes free

C:\xampp\mysql\bin>mysql -h localhots -u root
ERROR 2005 (HY000): Unknown MySQL server host 'localhots' (11004)

C:\xampp\mysql\bin>mysql -h localhost -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 31
Server version: 5.1.41 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> delete database radio;
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 'datab
ase radio' at line 1
mysql> drop database radio;
Query OK, 4 rows affected (0.07 sec)

mysql> create database radio;\
Query OK, 1 row affected (0.00 sec)

mysql> use radio;
Database changed
mysql> create table stasiun (id_radio int(4) primary key not null auto_increment

    -> , nama varchar(100),alamat text, frekuensi varchar(100))engine=innodb;
Query OK, 0 rows affected (0.03 sec)

mysql> create table program (id_program int(5) primary key not null auto_increme

    -> nt, id_radio int(4) not null, nama_program varchar(50), onair_day text, o
nair_ho
    -> ur text)engine=innodb;
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 'auto_
increme
nt, id_radio int(4) not null, nama_program varchar(50), onair_day t' at line 1
mysql> create table program (id_program int(5) primary key not null auto_increme

    -> nt, id_radio int(4) not null, nama_program varchar(50), onair_day text, o
nair_ho
    -> ur text)engine=innodb;
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 'auto_
increme
nt, id_radio int(4) not null, nama_program varchar(50), onair_day t' at line 1
mysql> create table program (id_program int(5) primary key not null auto_increme
nt, id_radio int(4) not null, nama_program varchar(50), onair_day text, onair_ho
ur text)engine=innodb;
Query OK, 0 rows affected (0.03 sec)

mysql> create table detil_penyiar (id_penyiar int(5) primary key not null auto_i
ncrement, nama varchar(100), jenis_kelamin varchar(1), no_hp  varchar(16))engine
=innodb;
Query OK, 0 rows affected (0.06 sec)

mysql> create table penyiar (id int(5), id_penyiar int(5), id_program int(5))eng
ine=innodb;
Query OK, 0 rows affected (0.03 sec)

mysql> insert into stasiun values('1','bekasi center','cyber park b1/15','111.1'
);
Query OK, 1 row affected (0.02 sec)

mysql> insert into stasiun values('2','gen fm','bekasi utara a1/6','98.7');
Query OK, 1 row affected (0.02 sec)

mysql> desc program;
+--------------+-------------+------+-----+---------+----------------+
| Field        | Type        | Null | Key | Default | Extra          |
+--------------+-------------+------+-----+---------+----------------+
| id_program   | int(5)      | NO   | PRI | NULL    | auto_increment |
| id_radio     | int(4)      | NO   |     | NULL    |                |
| nama_program | varchar(50) | YES  |     | NULL    |                |
| onair_day    | text        | YES  |     | NULL    |                |
| onair_hour   | text        | YES  |     | NULL    |                |
+--------------+-------------+------+-----+---------+----------------+
5 rows in set (0.01 sec)

mysql> insert into program values('101','1','canda sutra','senin-jumat','01;00-0
3;00')
    -> ;
Query OK, 1 row affected (0.02 sec)

mysql> insert into program values('102','2','telat sekolah','selasa,kamis,jumat'
,'03;00-04;00);
    '> '
    -> ;
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 1
mysql> insert into program values('102','2','telat sekolah','selasa,kamis,jumat'
,'03;00-04;00');
Query OK, 1 row affected (0.02 sec)

mysql> desc ddetil_penyiar;
ERROR 1146 (42S02): Table 'radio.ddetil_penyiar' doesn't exist
mysql> desc detil_penyiar;
+---------------+--------------+------+-----+---------+----------------+
| Field         | Type         | Null | Key | Default | Extra          |
+---------------+--------------+------+-----+---------+----------------+
| id_penyiar    | int(5)       | NO   | PRI | NULL    | auto_increment |
| nama          | varchar(100) | YES  |     | NULL    |                |
| jenis_kelamin | varchar(1)   | YES  |     | NULL    |                |
| no_hp         | varchar(16)  | YES  |     | NULL    |                |
+---------------+--------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

mysql> insert into detil_penyiar values('201','sucaksono','L','0878885695');
Query OK, 1 row affected (0.02 sec)

mysql> insert into detil_penyiar values('202','wagibin','L','081343676895');
Query OK, 1 row affected (0.02 sec)

mysql> desc penyiar;
+------------+--------+------+-----+---------+-------+
| Field      | Type   | Null | Key | Default | Extra |
+------------+--------+------+-----+---------+-------+
| id         | int(5) | YES  |     | NULL    |       |
| id_penyiar | int(5) | YES  |     | NULL    |       |
| id_program | int(5) | YES  |     | NULL    |       |
+------------+--------+------+-----+---------+-------+
3 rows in set (0.00 sec)

mysql> insert into penyiar values('1','201','101')
    -> ;
Query OK, 1 row affected (0.01 sec)

mysql> insert into penyiar values('2','202','102')
    -> ;
Query OK, 1 row affected (0.02 sec)

mysql> alter table program add constraint foreign key (id_radio) references stas
iun (id_radio) on delete cascade on update cascade;
Query OK, 2 rows affected (0.06 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> alter table penyiar add constraint FK_mykey foreign key (id_program) refe
rences program (id_program) on delete cascade on update cascade;
Query OK, 2 rows affected (0.09 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> alter table detil_penyiar add constraint FK_mykey1 foreign key (id_penyia
r) references penyiar (id_penyiar)on delete cascade on update cascade;
ERROR 1005 (HY000): Can't create table 'radio.#sql-668_1f' (errno: 150)
mysql> alter table penyiar (id_penyiar) add constraint FK_mykey1 foreign key (id
_penyiar) references detil_penyiar (id_penyiar)on delete cascade on update casca
de;
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 '(id_p
enyiar) add constraint FK_mykey1 foreign key (id_penyiar) references detil_' at
line 1
mysql> alter table penyiar add constraint FK_mykey1 foreign key (id_penyiar) ref
erences detil_penyiar (id_penyiar)on delete cascade on update cascade;
Query OK, 2 rows affected (0.07 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> select*from stasiun
    -> ;
+----------+---------------+-------------------+-----------+
| id_radio | nama          | alamat            | frekuensi |
+----------+---------------+-------------------+-----------+
|        1 | bekasi center | cyber park b1/15  | 111.1     |
|        2 | gen fm        | bekasi utara a1/6 | 98.7      |
+----------+---------------+-------------------+-----------+
2 rows in set (0.00 sec)

mysql> select * from program;
+------------+----------+---------------+--------------------+-------------+
| id_program | id_radio | nama_program  | onair_day          | onair_hour  |
+------------+----------+---------------+--------------------+-------------+
|        101 |        1 | canda sutra   | senin-jumat        | 01;00-03;00 |
|        102 |        2 | telat sekolah | selasa,kamis,jumat | 03;00-04;00 |
+------------+----------+---------------+--------------------+-------------+
2 rows in set (0.00 sec)

mysql> select * from detil_penyiar;
+------------+-----------+---------------+--------------+
| id_penyiar | nama      | jenis_kelamin | no_hp        |
+------------+-----------+---------------+--------------+
|        201 | sucaksono | L             | 0878885695   |
|        202 | wagibin   | L             | 081343676895 |
+------------+-----------+---------------+--------------+
2 rows in set (0.00 sec)

mysql> select* from penyiar;
+------+------------+------------+
| id   | id_penyiar | id_program |
+------+------------+------------+
|    1 |        201 |        101 |
|    2 |        202 |        102 |
+------+------------+------------+
2 rows in set (0.00 sec)

mysql>

Senin, 27 Agustus 2012

0 ALTER TABLE PADA DATABASE MOTOR; CMD

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\pcs31>cd\xampp\mysql\bin

C:\xampp\mysql\bin>dir/w
 Volume in drive C has no label.
 Volume Serial Number is 3837-CD8F

 Directory of C:\xampp\mysql\bin

[.]                     [..]                    bug25714.exe
comp_err.exe            echo.exe                libmysql.dll
my.ini                  myisamchk.exe           myisamlog.exe
myisampack.exe          myisam_ftdump.exe       mysql.exe
mysqladmin.exe          mysqlbinlog.exe         mysqlcheck.exe
mysqld.exe              mysqldump.exe           mysqlimport.exe
mysqlmanager.exe        mysqlshow.exe           mysqlslap.exe
mysqltest.exe           mysql_client_test.exe   mysql_config.bat
mysql_config.pl         mysql_upgrade.exe       my_print_defaults.exe
perror.exe              replace.exe             resolveip.exe
              28 File(s)     42.888.587 bytes
               2 Dir(s)  55.417.294.848 bytes free

C:\xampp\mysql\bin>mysql -h localhost -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.41 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cdcol              |
| coba               |
| mysql              |
| phpmyadmin         |
| test               |
+--------------------+
6 rows in set (0.00 sec)


mysql> create database motor;
Query OK, 1 row affected (0.00 sec)

mysql> use motor;
Database changed
mysql> create table vendor (id_vendor int not null auto_increment, id_type int not null, name varchar(100), primary key(id_vendor))engine=innodb;
Query OK, 0 rows affected (0.21 sec)

mysql> desc vendor
    -> ;
+-----------+--------------+------+-----+---------+----------------+
| Field     | Type         | Null | Key | Default | Extra          |
+-----------+--------------+------+-----+---------+----------------+
| id_vendor | int(11)      | NO   | PRI | NULL    | auto_increment |
| id_type   | int(11)      | NO   |     | NULL    |                |
| name      | varchar(100) | YES  |     | NULL    |                |
+-----------+--------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)

mysql> create table type (id_type int not null auto_increment, type varchar(100), warna varchar(100), primary key(id_type))engine=innodb;
Query OK, 0 rows affected (0.14 sec)

mysql> desc type;
+---------+--------------+------+-----+---------+----------------+
| Field   | Type         | Null | Key | Default | Extra          |
+---------+--------------+------+-----+---------+----------------+
| id_type | int(11)      | NO   | PRI | NULL    | auto_increment |
| type    | varchar(100) | YES  |     | NULL    |                |
| warna   | varchar(100) | YES  |     | NULL    |                |
+---------+--------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)

mysql> alter table vendor add constraint FK_motor foreign key (id_type) references type (id_type) on delete cascade on update cascade;
Query OK, 0 rows affected (0.30 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> insert into type values(1,'blade','merah');
Query OK, 1 row affected (0.09 sec)s

mysql> insert into type (type,warna) values ('beat','biru');
Query OK, 1 row affected (0.09 sec)

mysql> insert into vendor (id_type,name) values (1,'yamaha'),(2,'honda');
Query OK, 2 rows affected (0.08 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> select vendor.id_type, vendor.name, type.type, type.warna from vendor, type where vendor.id_type=type.id_type;
+---------+--------+------+-------+
| id_type | name   | type | warna |
+---------+--------+------+-------+
|       1 | yamaha | mio  | merah |
|       2 | honda  | beat | biru  |
+---------+--------+------+-------+
2 rows in set (0.04 sec)

mysql> insert into type (type, warna) values ('scoopy','hijau'),('astrea','hitam')
    -> ;
Query OK, 2 rows affected (0.31 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> select*from type;
+---------+--------+-------+
| id_type | type   | warna |
+---------+--------+-------+
|       1 | mio    | merah |
|       2 | beat   | biru  |
|       3 | scoopy | hijau |
|       4 | astrea | hitam |
+---------+--------+-------+
4 rows in set (0.00 sec)

mysql> select *from vendor;
+-----------+---------+--------+
| id_vendor | id_type | name   |
+-----------+---------+--------+
|         1 |       1 | yamaha |
|         2 |       2 | honda  |
+-----------+---------+--------+
2 rows in set (0.00 sec)

mysql> select vendor.id_type, vendor.name, type.type, type.warna from vendor, type where vendor.id_type=type.id_type;
+---------+--------+------+-------+
| id_type | name   | type | warna |
+---------+--------+------+-------+
|       1 | yamaha | mio  | merah |
|       2 | honda  | beat | biru  |
+---------+--------+------+-------+
2 rows in set (0.00 sec)

mysql> insert into vendor (id_type,name) values (2,'honda'),(2,'honda');
Query OK, 2 rows affected (0.07 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> select vendor.id_type, vendor.name, type.type, type.warna from vendor, type where vendor.id_type=type.id_type;
+---------+--------+------+-------+
| id_type | name   | type | warna |
+---------+--------+------+-------+
|       1 | yamaha | mio  | merah |
|       2 | honda  | beat | biru  |
|       2 | honda  | beat | biru  |
|       2 | honda  | beat | biru  |
+---------+--------+------+-------+
4 rows in set (0.00 sec)

mysql> select*from type;
+---------+--------+-------+
| id_type | type   | warna |
+---------+--------+-------+
|       1 | mio    | merah |
|       2 | beat   | biru  |
|       3 | scoopy | hijau |
|       4 | astrea | hitam |
+---------+--------+-------+
4 rows in set (0.00 sec)

mysql> select*from vendor;
+-----------+---------+--------+
| id_vendor | id_type | name   |
+-----------+---------+--------+
|         1 |       1 | yamaha |
|         2 |       2 | honda  |
|         3 |       2 | honda  |
|         4 |       2 | honda  |
+-----------+---------+--------+
4 rows in set (0.00 sec)

mysql> delete from vendor where id_vendor = 3 and 4;
Query OK, 1 row affected (0.05 sec)

mysql> select*from vendor;
+-----------+---------+--------+
| id_vendor | id_type | name   |
+-----------+---------+--------+
|         1 |       1 | yamaha |
|         2 |       2 | honda  |
|         4 |       2 | honda  |
+-----------+---------+--------+
3 rows in set (0.00 sec)

mysql> delete from vendor where id_vendor = 4;
Query OK, 1 row affected (0.06 sec)

mysql> select*from vendor;
+-----------+---------+--------+
| id_vendor | id_type | name   |
+-----------+---------+--------+
|         1 |       1 | yamaha |
|         2 |       2 | honda  |
+-----------+---------+--------+
2 rows in set (0.00 sec)

mysql> insert into vendor (id_type, name) values (3,'honda'), (4,'honda');
Query OK, 2 rows affected (0.28 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> select*from vendor;
+-----------+---------+--------+
| id_vendor | id_type | name   |
+-----------+---------+--------+
|         1 |       1 | yamaha |
|         2 |       2 | honda  |
|         5 |       3 | honda  |
|         6 |       4 | honda  |
+-----------+---------+--------+
4 rows in set (0.00 sec)

mysql> select vendor.id_type, vendor.name, type.type, type.warna from vendor, type where vendor.id_type=type.id_type;
+---------+--------+--------+-------+
| id_type | name   | type   | warna |
+---------+--------+--------+-------+
|       1 | yamaha | mio    | merah |
|       2 | honda  | beat   | biru  |
|       3 | honda  | scoopy | hijau |
|       4 | honda  | astrea | hitam |
+---------+--------+--------+-------+
4 rows in set (0.00 sec)

mysql> Bye
Ctrl-C -- exit!

Senin, 06 Agustus 2012

0 MYSQL PADA CMD

                34 File(s)    129.743.561 bytes
                2 Dir(s)  53.382.750.208 bytes free

C:\xampp\mysql\bin>dir\w
 Volume in drive C has no label.
 Volume Serial Number is 3837-CD8F

 Directory of C:\

File Not Found

C:\xampp\mysql\bin>dir \w
 Volume in drive C has no label.
 Volume Serial Number is 3837-CD8F

 Directory of C:\

File Not Found

C:\xampp\mysql\bin>dir/2
Invalid switch - "2".

C:\xampp\mysql\bin>dir/w
 Volume in drive C has no label.
 Volume Serial Number is 3837-CD8F

 Directory of C:\xampp\mysql\bin

[.]                              [..]
echo.exe                                                                my.ini
myisamchk.exe                                                      myisamlog.exe
myisampack.exe                                                    myisam_ftdump.exe
mysql.exe                                                              mysqladmin.exe
mysqlbinlog.exe                                                     mysqlcheck.exe
mysqld-debug.exe                                                 mysqld.exe
mysqldump.exe                                                     mysqldumpslow.pl
mysqld_multi.pl                                                     mysqlhotcopy.pl
mysqlimport.exe                                                    mysqlshow.exe
mysqlslap.exe                                                        mysqltest.exe
mysqltest_embedded.exe                                       mysql_client_test.exe
mysql_client_test_embedded.exe                           mysql_config.pl
mysql_convert_table_format.pl                              mysql_embedded.exe
mysql_plugin.exe                                                   mysql_secure_installation.pl
mysql_tzinfo_to_sql.exe                                        mysql_upgrade.exe
my_print_defaults.exe                                           perror.exe
replace.exe                                                          resolveip.exe
              34 File(s)    129.743.561 bytes
               2 Dir(s)  53.385.478.144 bytes free

C:\xampp\mysql\bin>mysql -h localhost -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.25a MySQL Community Server (GPL)

Copyright (c) 2000, 2011, 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 database;
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 'datab
ase' at line 1
mysql> show database
    -> \c
mysql> show databases
    -> \c
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cdcol              |
| mysql              |
| performance_schema |
| phpmyadmin         |
| test               |
| webauth            |
+--------------------+
7 rows in set (0.00 sec)

mysql> create database datamotor;
Query OK, 1 row affected (0.00 sec)

mysql> use datamotor;
Database changed
mysql> create table motor (id_motor int(10) auto_increment PK, nama_siswa varcha
r(100) not null, merk_motor varchar(50) not null, plat_motor varchar(8) not null
)
    -> create table motor (id_motor int(10) auto_increment PK, nama_siswa varcha
r(100) not null, merk_motor varchar(50) not null, plat_motor varchar(8) not null
)
    -> \c
mysql> create table motor (id_motor int(10) auto_increment primary key, nama_sis
wa varchar(100) not null, merk_motor varchar(50) not null, plat_motor varchar(8)
 not null)
    -> \c
mysql> create table motor (id_motor int() auto_increment primary key, nama_siswa
 varchar(100) not null, merk_motor varchar(50) not null, plat_motor varchar(8) n
ot null)
    -> \c
mysql> create table motor (id_motor int(10) auto_increment primary key,nama_sisw
a varchar(100) not null,merk_motor varchar(50) not null,plat_motor varchar(8) no
t null)
    -> \c
mysql> create table motor (id_motor int(10) auto_increment primary key,nama_sisw
a varchar(100) not null,merk_motor varchar(50) not null,plat_motor varchar(8) no
t null);
Query OK, 0 rows affected (0.05 sec)

mysql> create table motor (id_motor int(10) auto_increment primary key,nama_sisw
a varchar(100) not null,merk_motor varchar(50) not null,plat_motor varchar(8) no
t null);
ERROR 1050 (42S01): Table 'motor' already exists
mysql> delete table motor
    -> \c
mysql> delete table motor;
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 'table
 motor' at line 1
mysql> drop table motor;
Query OK, 0 rows affected (0.01 sec)

mysql> create table motor (id_motor int(10) auto_increment primary key,nama_sisw
a varchar(100) not null,merk_motor varchar(50) not null,plat_motor varchar(8) no
t null);
Query OK, 0 rows affected (0.03 sec)

mysql> insert into motor ('123457890','jordan','ninja','B1423HB');
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 ''1234
57890','jordan','ninja','B1423HB')' at line 1
mysql> insert into motor ('123457890','jordan','ninja','B142B');
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 ''1234
57890','jordan','ninja','B142B')' at line 1
mysql> insert into motor values ('1234567890','jordan','ninja','B142B');
Query OK, 1 row affected (0.02 sec)

mysql> select * from motor
    -> ;
+------------+------------+------------+------------+
| id_motor   | nama_siswa | merk_motor | plat_motor |
+------------+------------+------------+------------+
| 1234567890 | jordan     | ninja      | B142B      |
+------------+------------+------------+------------+
1 row in set (0.00 sec)

mysql> desc motor;
+------------+--------------+------+-----+---------+----------------+
| Field      | Type         | Null | Key | Default | Extra          |
+------------+--------------+------+-----+---------+----------------+
| id_motor   | int(10)      | NO   | PRI | NULL    | auto_increment |
| nama_siswa | varchar(100) | NO   |     | NULL    |                |
| merk_motor | varchar(50)  | NO   |     | NULL    |                |
| plat_motor | varchar(8)   | NO   |     | NULL    |                |
+------------+--------------+------+-----+---------+----------------+
4 rows in set (0.03 sec)

mysql> insert into motor values ('1234567891,'ridan,'beat','B2354JHK');
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 'ridan
,'beat','B2354JHK')' at line 1
mysql> insert into motor values ('1234567891','ridan,'beat','B2354JHK');
    '> ;
    '> \c
    '> \c
    '> insert into motor values ('1234567891','ridan,'beat','B2354JHK');
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 'beat'
,'B2354JHK');
;
\c
\c
insert into motor values ('1234567891','ridan,'beat',' at line 1
mysql> insert into motor values ('1234567891','ridan,'beat','B2354HK');
    '> \c
    '> insert into motor values ('1234567891','ridan,'beat','B2354HK');
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 'beat'
,'B2354HK');
\c
insert into motor values ('1234567891','ridan,'beat','B2354' at line 1
mysql> insert into motor values ('1234567891','ridan','beat','B2354HK');
Query OK, 1 row affected (0.02 sec)

mysql> insert into motor values ('1234567892','velan','cs-1','B9487KJH');
Query OK, 1 row affected (0.01 sec)

mysql> insert into motor values ('1234567893','boy','scorpio-z','B585ADR');
Query OK, 1 row affected (0.02 sec)

mysql> insert into motor values ('1234567894','chyntia','vario','B6182JGH');
Query OK, 1 row affected (0.01 sec)

mysql> insert into motor values ('1234567895','yosephine','blade','B7723AAA');
Query OK, 1 row affected (0.02 sec)

mysql> select * from motor
    -> ;
+------------+------------+------------+------------+
| id_motor   | nama_siswa | merk_motor | plat_motor |
+------------+------------+------------+------------+
| 1234567890 | jordan     | ninja      | B142B      |
| 1234567891 | ridan      | beat       | B2354HK    |
| 1234567892 | velan      | cs-1       | B9487KJH   |
| 1234567893 | boy        | scorpio-z  | B585ADR    |
| 1234567894 | chyntia    | vario      | B6182JGH   |
| 1234567895 | yosephine  | blade      | B7723AAA   |
+------------+------------+------------+------------+
6 rows in set (0.00 sec)

mysql>
 

My Lesson Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates