Cara Membuat Data Base

Embed Size (px)

DESCRIPTION

sintag data bases degan cmd

Citation preview

C:\Documents and Settings\LAB.1>cd C:\xampp\mysql\binC:\xampp\mysql\bin>C:\xampp\mysql\bin>mysql -u rootWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.1.41 Source distributionType 'help;' or '\h' for help. Type '\c' to clear the current input smysql> show databases;+--------------------+| Database |+--------------------+| information_schema || cdcol || mysql || phpmyadmin || test |+--------------------+5 rows in set (0.06 sec)mysql> create database latihan1 -> create database latihan1;ERROR 1064 (42000): You have an error in your SQL syntax; check the mcorresponds to your MySQL server version for the right syntax to usee database latihan1' at line 2mysql> create database latihan1;Query OK, 1 row affected (0.00 sec)mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || cdcol || latihan1 || mysql || phpmyadmin || test |+--------------------+6 rows in set (0.00 sec)mysql> drop database latihan1;Query OK, 0 rows affected (0.08 sec)mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || cdcol || mysql || phpmyadmin || test |+--------------------+5 rows in set (0.00 sec)mysql> create database latihan1;Query OK, 1 row affected (0.00 sec)mysql> use latihan1;Database changedmysql> create table mahasiswa -> (nim int primary key , nama char(50)) -> ;Query OK, 0 rows affected (0.06 sec)mysql> show tables;+--------------------+| Tables_in_latihan1 |+--------------------+| mahasiswa |+--------------------+1 row in set (0.00 sec)mysql> desc mahasiswa;+-------+----------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-------+----------+------+-----+---------+-------+| nim | int(11) | NO | PRI | NULL | || nama | char(50) | YES | | NULL | |+-------+----------+------+-----+---------+-------+2 rows in set (0.00 sec)mysql>mysql> drop table mahasiswa;Query OK, 0 rows affected (0.00 sec)mysql> create table mahasiswa -> (nim int (15) primary key, nama char (50) not null);Query OK, 0 rows affected (0.05 sec)mysql>