Kamis, 13 Mei 2010

Contoh MySql

| Kamis, 13 Mei 2010 | 0 komentar

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\labdasar4_1>cd\

C:\>cd program files\xampp\mysql\bin
The system cannot find the path specified.

C:\>cd program files\xampp\mysql\bin\mysql-u-root-p
The system cannot find the path specified.

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

C:\>cd\

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

C:\>xampp\mysql\bin\mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.45-community-nt MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql;
Database changed
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| cdcol |
| ijem |
| mysql |
| phpmyadmin |
| test |
| webauth |
+--------------------+
7 rows in set (0.02 sec)

mysql> create database (karyawan);
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 '(kary
awan)' at line 1
mysql> create database (karyawan);
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 '(kary
awan)' at line 1
mysql> create database(karyawan);
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 '(kary
awan)' at line 1
mysql> create database karyawan;
Query OK, 1 row affected (0.00 sec)

mysql> use karyawan;
Database changed
mysql> create table pekerja (id_kary char(5) not null primary key,nama varchar(3
0),jk varchar(2),jabatan varchar(20),gaji int);
Query OK, 0 rows affected (0.05 sec)

mysql> desk pekerja;
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 'desk
pekerja' at line 1
mysql> desc pekerja;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| id_kary | char(5) | NO | PRI | | |
| nama | varchar(30) | YES | | NULL | |
| jk | varchar(2) | YES | | NULL | |
| jabatan | varchar(20) | YES | | NULL | |
| gaji | int(11) | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
5 rows in set (0.01 sec)

mysql> insert into pekerja values ('01','andi','L','directur','5000000');
Query OK, 1 row affected (0.01 sec)

mysql> desc pekerja;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| id_kary | char(5) | NO | PRI | | |
| nama | varchar(30) | YES | | NULL | |
| jk | varchar(2) | YES | | NULL | |
| jabatan | varchar(20) | YES | | NULL | |
| gaji | int(11) | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
5 rows in set (0.01 sec)

mysql> show pekerja;
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 'peker
ja' at line 1
mysql> desc pekerja;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| id_kary | char(5) | NO | PRI | | |
| nama | varchar(30) | YES | | NULL | |
| jk | varchar(2) | YES | | NULL | |
| jabatan | varchar(20) | YES | | NULL | |
| gaji | int(11) | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
5 rows in set (0.00 sec)

mysql> select*from pekerja;
+---------+------+------+----------+---------+
| id_kary | nama | jk | jabatan | gaji |
+---------+------+------+----------+---------+
| 01 | andi | L | directur | 5000000 |
+---------+------+------+----------+---------+
1 row in set (0.00 sec)

mysql> insert into karyawan values('02','pandi,'L','PU','5000000');
'> insert into pekerja values('02','pandi','L','PU','5000000');
'> select*from pekerja;
'> ';;l
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 'L','P
U','5000000');
insert into pekerja values('02','pandi','L','PU','5000000');' at line 1
ERROR:
No query specified

-> ';
'> ';
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 'l
';
'' at line 1
mysql> insert into pekerja values('02','pepi','L','PU','5000000');
Query OK, 1 row affected (0.00 sec)

mysql> select*from pekerja;
+---------+------+------+----------+---------+
| id_kary | nama | jk | jabatan | gaji |
+---------+------+------+----------+---------+
| 01 | andi | L | directur | 5000000 |
| 02 | pepi | L | PU | 5000000 |
+---------+------+------+----------+---------+
2 rows in set (0.02 sec)

mysql>

0 komentar:

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Posting Komentar

 
My Popularity (by popuri.us)

Advertisement

Mini Updates

© Copyright 2010. yourblogname.com . All rights reserved | yourblogname.com is proudly powered by Blogger.com | Template by dolvhic.com - zoomtemplate.com