(Basic Concepts 02) SQL 문: SELECT
SoloLearn SQL 번역
Basic SQL Commands
SQL 기본 명령어
- The SQL
SHOWstatement displays information contained in the database and its tables.- SQL
SHOW문은 데이터베이스와 테이블에 포함된 정보를 보여준다.
- SQL
- This helpful tool lets you keep track of your database contents and remind yourself about the structure of your tables.
- 이 유용한 툴은 데이터베이스 내용을 추적하고, 테이블 구조에 대해 떠올릴 수 있게 한다.
- For example, the
SHOW DATABASEScommand lists the databases managed by the server.- 예를 들어,
SHOW DATABASES명령어는 서버가 관리하는 데이터베이스를 나열한다.
- 예를 들어,
SHOW DATABASES
- Throughout the tutorial we will be using the MySQL engine and the PHPMyAdmin tool to run SQL queries.
- 이 튜토리얼에서는 MySQL 엔진과 PHPMyAdmin 툴을 사용해서 SQL query를 실행한다.
- The
SHOW TABLEScommand is used to display all of the tables in the currently selected MySQL database.SHOW TABLES명령어는 현재 선택된 MySQL 데이터베이스의 모든 테이블을 보여주는 데 사용된다.

For our example, we have created a database,
my_database, with a table calledcustomers.이전에,
customers테이블이 있는my_database데이터베이스를 생성했다.
SHOW COLUMNSdisplays information about the columns in a given table.SHOW COLUMNS는 주어진 테이블의 column에 대한 정보를 보여준다.
- The following example displays the columns in our
customerstable:- 다음 예제는
customers테이블의 column을 보여준다.
- 다음 예제는
SHOW COLUMNS FROM customers
- Result:

- SHOW COLUMNS displays the following values for each table column:
- SHOW COLUMNS는 각 테이블 column에 대해 아래의 값들을 보여준다.
Field: column name- column 이름
Type: column data type- column 데이터 타입
Key: indicates whether the column is indexed- column의 인덱싱 여부를 나타낸다.
Default: default value assigned to the column- column에 지정된 기본 값
Extra: may contain any additional information that is available about a given column- 주어진 column에 대해 사용할 수 있는 추가 정보가 포함될 수 있다.
The columns for the
customerstable have also been created using the PHPMyAdmin tool.
customers테이블의 column도 PHPMyAdmin 툴을 사용해서 생성되었다.
SELECT Statement
SELECT 문
- The
SELECTstatement is used to select data from a database.SELECT문은 데이터베이스에서 데이터를 선택하는 데 사용된다.
- The result is stored in a result table, which is called the
result-set.- 결과는
result-set이라는 result 테이블에 저장된다.
- 결과는
- A
querymay retrieve information from selected columns or from all columns in the table.query는 선택한 column 또는 테이블의 모든 column에서 정보를 검색할 수 있다.
- To create a simple SELECT statement, specify the name(s) of the column(s) you need from the table.
- 테이블에서 필요한 column의 이름을 지정해서 SELECT 문을 생성한다.
- Syntax of the SQL SELECT Statement:
- SQL SELECT 문의 구문:
SELECT column_list FROM table_name
column_listincludes one or more columns from which data is retrieved.
column_list에는 데이터가 검색되는 하나 이상의 column이 포함된다.
table_nameis the name of the table from which the information is retrieved.
table_name은 정보가 검색되는 테이블의 이름이다.
- Below is the data from our
customerstable:- 아래는
customers테이블의 데이터이다.
- 아래는

- The following SQL statement selects the
FirstNamefrom thecustomerstable:- 다음 SQL 문은
customers테이블의FirstName을 선택한다.
- 다음 SQL 문은
SELECT FirstName FROM customers

A SELECT statement retrieves zero or more rows from one or more database tables.
SELECT 문은 하나 이상의 데이터베이스 테이블에서 0개 이상의 row를 검색한다.
QUIZ
- Drag and drop from the options below to complete the command to list all of the databases.
- 모든 데이터베이스를 나열하는 명령어를 작성해라.
SHOW DATABASES
- Drag and drop from the options below to view a list of tables for the currently selected database.
- 현재 선택한 데이터베이스의 테이블 리스트를 살펴라.
SHOW TABLES
- Drag and drop from the options below to view the columns from the ‘customers’ table:
- ‘customers’ 테이블의 column을 살펴라.
SHOW COLUMNS FROM customers
- Rearrange the code to select the “name” column values from the “customers” table.
- “customers” 테이블의 “name” column 값을 선택해라.
SELECT name FROM customers