SQL 강좌 34. SQL Comments

SQL Comments

SQL상태를 설명하거나 SQL구문이 실행을 막기위해 사용된다.

Single Line Comments

--을 사용하면 한 줄 주석

--Select all:
SELECT * FROM Customers;

또는

SELECT * FROM Customers -- WHERE City='Berlin';

또는

--SELECT * FROM Customers;
SELECT * FROM Products;

Multi-line Comments

/* */을 사용하면 된다

/*Select all the columns
of all the records
in the Customers table:*/
SELECT * FROM Customers;
/*SELECT * FROM Customers;
SELECT * FROM Products;
SELECT * FROM Orders;
SELECT * FROM Categories;*/
SELECT * FROM Suppliers;

구문 중간에 사용해도 된다

SELECT CustomerName, /*City,*/ Country FROM Customers;

/* 있으면 */가 나올 때까지 주석처리

SELECT * FROM Customers WHERE (CustomerName LIKE 'L%'
OR CustomerName LIKE 'R%' /*OR CustomerName LIKE 'S%'
OR CustomerName LIKE 'T%'*/ OR CustomerName LIKE 'W%')
AND Country='USA'
ORDER BY CustomerName;

Comments