- mysql> show databases; / /mysql의 데이터베이스를 보여주세요
- mysql> use test; // Database의 test를 사용합니다
- mysql> show tables; // test의 테이블을 보여주세요
- mysql> select*from test1; // test1 table 전체출력
- mysql> select*from test1 where address = "서울시"; // address가 서울시인 test1 table전체 출력
Microsoft Windows [Version 10.0.19045.2728]
(c) Microsoft Corporation. All rights reserved.
C:\Users\EZEN-217T>mysql -uroot -pezen //mysql에 연결합니다
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 28
Server version: 8.0.32 MySQL Community Server - GPL
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
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> show databases; //mysql의 데이터베이스를 보여주세요
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sakila |
| sys |
| test |
| world |
+--------------------+
7 rows in set (0.00 sec)
mysql> use test; //Database의 test를 사용합니다
Database changed //
mysql> show tables; //test의 테이블을 보여주세요
+----------------+
| Tables_in_test |
+----------------+
| test1 |
| test2 |
+----------------+
2 rows in set (0.00 sec)
mysql> select*from test1;
+----+--------+------+---------+
| id | name | age | address |
+----+--------+------+---------+
| 1 | 홍길동 | 25 | 서울시 |
| 2 | 홍길순 | 23 | 서울시 |
| 3 | 강길순 | 22 | 인천시 |
| 4 | 고길동 | 40 | 안양시 |
| 5 | 강감찬 | 45 | 안양시 |
+----+--------+------+---------+
5 rows in set (0.00 sec)
mysql> select*from test1 where address = "서울시";
+----+--------+------+---------+
| id | name | age | address |
+----+--------+------+---------+
| 1 | 홍길동 | 25 | 서울시 |
| 2 | 홍길순 | 23 | 서울시 |
+----+--------+------+---------+
2 rows in set (0.00 sec)
'DB > 명령프롬프트 - mysql' 카테고리의 다른 글
[MySQL] student table - 테이블의 값을 다른 테이블로 옮기기 (4학년 친구들을 졸업) (0) | 2023.03.27 |
---|---|
[MySQL] product table - 테이블 생성 예제 (0) | 2023.03.27 |
[MySQL] product table - product테이블을 이용한 예제 (0) | 2023.03.27 |
[MySQL] 테이블의 행 여러 개 한번에 삭제하기 (0) | 2023.03.27 |
[MySQL] 원하는 위치의 데이터 추출 limit (0) | 2023.03.27 |