[Mysql] 기본 사용법

Hyunjun Kim·2025년 4월 23일
0

SQL

목록 보기
49/90

mysql> show schemas;

+--------------------+
| Database           |
+--------------------+
| basic              |
| information_schema |
| mysql              |
| performance_schema |
| project5           |
| qcc5&6             |
| sys                |
| test_db            |
+--------------------+
8 rows in set (0.001 sec)

``이렇게 백틱을 쓴다
mysql> create schema test_schema;

mysql> use test_schema;

mysql> create table table1 (id Int not null, name varchar(255), PRIMARY KEY(id));

mysql> show tables;

+-----------------------+
| Tables_in_test_schema |
+-----------------------+
| table1                |
+-----------------------+

mysql> describe table table1;

+----+-------------+--------+------------+------+---------------+------+---------+------+------+----------+-------+
| id | select_type | table  | partitions | type | possible_keys | key  | key_len | ref  | rows | filtered | Extra |
+----+-------------+--------+------------+------+---------------+------+---------+------+------+----------+-------+
|  1 | SIMPLE      | table1 | NULL       | ALL  | NULL          | NULL | NULL    | NULL |    1 |   100.00 | NULL  |
+----+-------------+--------+------------+------+---------------+------+---------+------+------+----------+-------+

mysql> describe table1;

+-------+--------------+------+-----+---------+-------+
| Field | Type         | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| id    | int          | NO   | PRI | NULL    |       |
| name  | varchar(255) | YES  |     | NULL    |       |
+-------+--------------+------+-----+---------+-------+

GUI를 사용하지 않으면 꽤나 사용하기 불편하다.

profile
Data Analytics Engineer 가 되

0개의 댓글