Kursus dan belajar komputer ms office, digital marketing, web programming, jaringan, linux, windows server, php, vb.net, mysql, mikrotik, seo, web desain, wordpress, cysco, database, oracle di cileungsi


Postingan Terbaru

Info Kursus Komputer YMII Cileungsi : 0858 8188 5768 (Mas Tris)

Kamis, 14 Juli 2016

Membuat Tabel di MySQL melalui Command Prompt di Windows

Haloo Guys, Jumpa lagi dengan saya di tutorial membuat database di mysql melalui command prompt.
Langkah awal adalah :
- Baca Bismillah
- Kemudian hidupkan komputer anda, dan nyalakan service apache dan mysql
- Kemudian masuk ke command prompt dan ketik perintah di bawah ini :


C:\Users\User>cd ..

C:\Users>cd ..

C:\>cd xampp

C:\xampp>cd mysql

C:\xampp\mysql>cd bin

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

Copyright (c) 2000, 2015, 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 penjualan
    ->
    -> create database penjualan;
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 'create database penjualan' at line 3
mysql> create database jualan;
Query OK, 1 row affected (0.01 sec)

mysql> use jualan
Database changed
mysql> create table barang (
    -> kode varchar (5) not null,
    -> nama varchar (20) not null,
    -> harga integer not null,
    -> primary key (kode)
    -> );
Query OK, 0 rows affected (0.70 sec)

mysql> insert into barang (kode, nama, harga) values ("001", "indomie goreng","2000");
Query OK, 1 row affected (0.10 sec)

mysql> select*from barang
    ->     -> Ctrl-C -- exit!

    -> select*from barang;
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 'select*from barang' at line 4
mysql> select*From barang;
+------+----------------+-------+
| kode | nama           | harga |
+------+----------------+-------+
| 001  | indomie goreng |  2000 |
+------+----------------+-------+
1 row in set (0.00 sec)

mysql> insert into barang (kode, nama, harga) values ("002", "pepsodent","5000");
Query OK, 1 row affected (0.08 sec)

mysql> insert into barang (kode, nama, harga) values ("003", "gillet","7500");
Query OK, 1 row affected (0.08 sec)

mysql> select*From barang;
+------+----------------+-------+
| kode | nama           | harga |
+------+----------------+-------+
| 001  | indomie goreng |  2000 |
| 002  | pepsodent      |  5000 |
| 003  | gillet         |  7500 |
+------+----------------+-------+
3 rows in set (0.00 sec)

mysql> update barang set nama_barang="shampo" where kode="001";
ERROR 1054 (42S22): Unknown column 'nama_barang' in 'field list'
mysql> update barang set nama="shampo" where kode="001";
Query OK, 1 row affected (0.08 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select*From barang;
+------+-----------+-------+
| kode | nama      | harga |
+------+-----------+-------+
| 001  | shampo    |  2000 |
| 002  | pepsodent |  5000 |
| 003  | gillet    |  7500 |
+------+-----------+-------+
3 rows in set (0.00 sec)

mysql>


Sekian dan terimakasih..:)


handphone-tablet

Tidak ada komentar:

Posting Komentar