Search the Whole World Here.,.,

SQL - SELECT Column Example




The following SQL statement selects the "CustomerName" and "City" columns from the "Customers" table:

Example

SELECT CustomerName,City FROM Customers;
Try it Yourself »

SQL - Comments in Statements




To ignore just a part of a statement, use the /* */ comment.
Any text between /* and */ will be ignored.

Example

Ignore part of a line:
SELECT CustomerName, /*City,*/ Country FROM Customers;
Try it Yourself »

Example

Ignore a parts of a statment:
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;
Try it Yourself »

SQL - Multi-line Comments




Multi-line comments start with /* and end with */.
Any text between /* and */ will be ignored.

Example

A multi-line comment as an explanation:
/*Select all the columns
of all the records
in the Customers table:*/

SELECT * FROM Customers;
Try it Yourself »

Example

A multi-line comment to ignore many statements:
/*SELECT * FROM Customers;
SELECT * FROM Products;
SELECT * FROM Orders;
SELECT * FROM Categories;*/

SELECT * FROM Suppliers;
Try it Yourself »

SQL - Single Line Comments




Single line comments start with --.
Any line between -- and the end of the line will be ignored (will not be executed).

Example

A single-line comment as an explanation:
--Select all:SELECT * FROM Customers;
Try it Yourself »

Example

A single-line comment to ignore the end of a line:
SELECT * FROM Customers -- WHERE City='Berlin';
Try it Yourself »

Example

A single-line comment to ignore a statement:
--SELECT * FROM Customers;SELECT * FROM Products;
Try it Yourself »

Ads by Google