membuat database mahasiswa



C:\Users\ACER>cd\

C:\>cd\xampp\mysql\bin

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.5.16 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> create database dbmahasiswa;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cdcol              |
| dbmahasiswa        |
| mysql              |
| performance_schema |
| phpmyadmin         |
| test               |
| webauth            |
+--------------------+
8 rows in set (0.48 sec)

mysql> use dbmahasiswa;
Database changed
mysql> create table mahasiswa(
    -> npm varchar(8),
    -> nama varchar(35),
    -> jejang varchar(3),
    -> jurusan varchar(30));
Query OK, 0 rows affected (0.17 sec)


mysql> desc mahasiswa;
+---------+-------------+------+-----+---------+-------+
| Field   | Type        | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| npm     | varchar(8)  | YES  |     | NULL    |       |
| nama    | varchar(35) | YES  |     | NULL    |       |
| jejang  | varchar(3)  | YES  |     | NULL    |       |
| jurusan | varchar(30) | YES  |     | NULL    |       |
+---------+-------------+------+-----+---------+-------+
4 rows in set (0.30 sec)

mysql> select*from mahasiswa;
Empty set (0.06 sec)


mysql> insert into mahasiswa values
    -> ('12110796','riyan','s1','tehnik imformatika');
Query OK, 1 row affected (0.05 sec)

mysql> select*from mahasiswa;
+----------+-------+--------+--------------------+
| npm      | nama  | jejang | jurusan            |
+----------+-------+--------+--------------------+
| 12110796 | riyan | s1     | tehnik imformatika |
+----------+-------+--------+--------------------+
1 row in set (0.00 sec)


mysql> select*from mahasiswa;
+----------+-------+--------+--------------------+
| npm      | nama  | jejang | jurusan            |
+----------+-------+--------+--------------------+
| 12110796 | riyan | s1     | tehnik imformatika |
+----------+-------+--------+--------------------+
1 row in set (0.00 sec)


mysql> insert into mahasiswa values
    -> ('12110797','sahrul','d3','manajemen informatika'),
    -> ('12110793','adek','d3','komputer akutansi'),
    -> ('12110798','kurbit','s1','sistem imformasi');
Query OK, 3 rows affected (0.02 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> select *from mahasiswa;
+----------+--------+--------+-----------------------+
| npm      | nama   | jejang | jurusan               |
+----------+--------+--------+-----------------------+
| 12110796 | riyan  | s1     | tehnik imformatika    |
| 12110797 | sahrul | d3     | manajemen informatika |
| 12110793 | adek   | d3     | komputer akutansi     |
| 12110798 | kurbit | s1     | sistem imformasi      |
+----------+--------+--------+-----------------------+
4 rows in set (0.00 sec)


mysql> create table dosen(
    -> nidn varchar(10),
    -> nama varchar(35),
    -> alamat varchar(50),
    -> telpon double);
Query OK, 0 rows affected (0.02 sec)

mysql> desc dosen;
+--------+-------------+------+-----+---------+-------+
| Field  | Type        | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------+
| nidn   | varchar(10) | YES  |     | NULL    |       |
| nama   | varchar(35) | YES  |     | NULL    |       |
| alamat | varchar(50) | YES  |     | NULL    |       |
| telpon | double      | YES  |     | NULL    |       |
+--------+-------------+------+-----+---------+-------+
4 rows in set (0.02 sec)


mysql> insert into dosen values
    -> ('11111','riyan','gunung tua',08319056),
    -> ('11221','riyan','sikumbu',08319046);
Query OK, 2 rows affected (0.03 sec)
Records: 2  Duplicates: 0  Warnings: 0


mysql> select *from dosen;
+-------+-------+------------+---------+
| nidn  | nama  | alamat     | telpon  |
+-------+-------+------------+---------+
| 11111 | riyan | gunung tua | 8319056 |
| 11221 | riyan | sikumbu    | 8319046 |
+-------+-------+------------+---------+
2 rows in set (0.06 sec)

mysql>

Subscribe to receive free email updates:

0 Response to "membuat database mahasiswa"

Post a Comment