C:\Windows\System32>cd \
C:\>cd xampp
C:\xampp>cd mysql
C:\xampp\mysql>cd bin
C:\xampp\mysql\bin>mysql -uroot -p
Enter password:
MariaDB [(none)]> create database testdb;
Query OK, 1 row affected (0.003 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| phpmyadmin |
| test |
| testdb |
+--------------------+
6 rows in set (0.043 sec)
MariaDB [(none)]> use testdb;
Database changed
MariaDB [testdb]> show tables;
Empty set (0.001 sec)
MariaDB [testdb]> create table toy (
-> toyname varchar(10),
-> price int(6));
Query OK, 0 rows affected (0.029 sec)
MariaDB [testdb]> show tables;
+------------------+
| Tables_in_testdb |
+------------------+
| toy |
+------------------+
1 row in set (0.001 sec)
MariaDB [testdb]> desc toy;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| toyname | varchar(10) | YES | | NULL | |
| price | int(6) | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
2 rows in set (0.030 sec)
MariaDB [testdb]> insert into toy values('Lego House', 25000);
Query OK, 1 row affected (0.064 sec)
MariaDB [testdb]> insert into toy values('Lego Robot', 27000);
Query OK, 1 row affected (0.003 sec)
MariaDB [testdb]> select * from toy;
+------------+-------+
| toyname | price |
+------------+-------+
| Lego House | 25000 |
| Lego Robot | 27000 |
+------------+-------+
2 rows in set (0.001 sec)
MariaDB [testdb]> select * from toy where toyname = "Lego House";
+------------+-------+
| toyname | price |
+------------+-------+
| Lego House | 25000 |
+------------+-------+
1 row in set (0.002 sec)
LIST
'📖 Coding Study > 웹 프로그래밍' 카테고리의 다른 글
2023.05.02 화 (DB 계속) (0) | 2023.05.03 |
---|---|
2023.04.04 화 (PHP 다차원 배열) (0) | 2023.04.04 |
2023.04.03 월 (PHP 배열) (0) | 2023.04.03 |
2023.03.28 화 (PHP 반복문, breakㆍcontinue 키워드, 배열) (0) | 2023.03.28 |
2023.03.27 월 (PHP 조건문) (0) | 2023.03.27 |