Вы находитесь на странице: 1из 2

C:\Users\FRINDO_NOTE> cd c:\\xampp\mysql\bin

c:\xampp\mysql\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.51a Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> create database mahasiswa;
Query OK, 1 row affected (0.05 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| cdcol |
| mahasiswa |
| mysql |
| phpmyadmin |
| test |
| webauth |
+--------------------+
8 rows in set (0.11 sec)
mysql> use mahasiswa
Database changed

mysql> create table data_mhs(id_mhs int(4) not null primary key, nama varchar(30
) not null, nim varchar(8) not null, alamat varchar(40) not null, thn_masuk int(
40) not null);
Query OK, 0 rows affected (0.06 sec)

mysql> insert into data_mhs values('1','Laode','ab1c1001','Jl.a.yani','2008');


Query OK, 1 row affected (0.06 sec)
mysql> insert into data_mhs values('2','suprianto','ab1c1002','Jl.jati raya','20
08');
Query OK, 1 row affected (0.00 sec)
mysql> insert into data_mhs values('3','irham rahman','ab1c1003','mandonga kota
kendari','2008');
Query OK, 1 row affected (0.00 sec)
mysql> insert into data_mhs values('4','yuliana sapar','ab1c1004','Jl.sutoyo no
48 kadia kota kendari','2008');
Query OK, 1 row affected (0.00 sec)

mysql> select*from data_mhs;


+--------+---------------+----------+------------------------------------+------
-----+
| id_mhs | nama | nim | alamat | thn_m
asuk |
+--------+---------------+----------+------------------------------------+------
-----+
| 1 | Laode | ab1c1001 | Jl.a.yani |
2008 |
| 2 | suprianto | ab1c1002 | Jl.jati raya |
2008 |
| 3 | irham rahman | ab1c1003 | mandonga kota kendari |
2008 |
| 4 | yuliana sapar | ab1c1004 | Jl.sutoyo no 48 kadia kota kendari |
2008 |
+--------+---------------+----------+------------------------------------+------
-----+

mysql> select*from data_mhs where id_mhs=1;


+--------+-------+----------+-----------+-----------+
| id_mhs | nama | nim | alamat | thn_masuk |
+--------+-------+----------+-----------+-----------+
| 1 | Laode | ab1c1001 | Jl.a.yani | 2008 |
+--------+-------+----------+-----------+-----------+
1 row in set (0.02 sec)
mysql> select*from data_mhs where id_mhs<2;
+--------+-------+----------+-----------+-----------+
| id_mhs | nama | nim | alamat | thn_masuk |
+--------+-------+----------+-----------+-----------+
| 1 | Laode | ab1c1001 | Jl.a.yani | 2008 |
+--------+-------+----------+-----------+-----------+
1 row in set (0.03 sec)

mysql> select*from data_mhs where id_mhs>2;


+--------+---------------+----------+------------------------------------+------
-----+
| id_mhs | nama | nim | alamat | thn_m
asuk |
+--------+---------------+----------+------------------------------------+------
-----+
| 3 | irham rahman | ab1c1003 | mandonga kota kendari |
2008 |
| 4 | yuliana sapar | ab1c1004 | Jl.sutoyo no 48 kadia kota kendari |
2008 |
+--------+---------------+----------+------------------------------------+------
-----+
2 rows in set (0.00 sec)

Вам также может понравиться