- Introduction To SQL
- SQL Syntax
- SQL SELECT Statement
- SQL SELECT DISTINCT Statement
- SQL WHERE Clause
- SQL AND, OR And NOT Operators
- SQL ORDER BY Keyword
- SQL INSERT INTO Statement
- SQL NULL Values
- SQL UPDATE Statement
- SQL DELETE Statement
- SQL TOP, LIMIT, FETCH FIRST Or ROWNUM Clause
- SQL MIN() And MAX() Functions
- SQL COUNT(), AVG() And SUM() Functions
- SQL LIKE Operator
- SQL Wildcards
- SQL IN Operator
- SQL BETWEEN Operator
- SQL Aliases
- SQL Joins
- SQL INNER JOIN Keyword
- SQL LEFT JOIN Keyword
- SQL RIGHT JOIN Keyword
- SQL FULL OUTER JOIN Keyword
- SQL Self Join
- SQL UNION Operator
- SQL GROUP BY Statement
- SQL HAVING Clause
- SQL EXISTS Operator
- SQL ANY And ALL Operators
- SQL SELECT INTO Statement
- SQL INSERT INTO SELECT Statement
- SQL CASE Statement
- SQL NULL Functions
- SQL Stored Procedures For SQL Server
- SQL Comments
- SQL Operators
- SQL CREATE DATABASE Statement
- SQL DROP DATABASE Statement
- SQL BACKUP DATABASE For SQL Server
- SQL CREATE TABLE Statement
- SQL DROP TABLE Statement
- SQL ALTER TABLE Statement
- SQL Constraints
- SQL NOT NULL Constraint
- SQL UNIQUE Constraint
- SQL PRIMARY KEY Constraint
- SQL FOREIGN KEY Constraint
- ALTER TABLE Orders DROP CONSTRAINT FK_PersonOrder;
- SQL DEFAULT Constraint
- SQL CREATE INDEX Statement
- SQL AUTO INCREMENT Field
- SQL Working With Dates
- SQL Views
- SQL Injection
- SQL Hosting
- SQL Data Types For MySQL, SQL Server, And MS Access
SQL Comments
SQL Comments
Comments are used to explain sections of SQL statements, or to prevent execution of SQL statements.
Note: The examples in this chapter will not work in Firefox and Microsoft Edge!
Comments are not supported in Microsoft Access databases. Firefox and Microsoft Edge are using Microsoft Access database in our examples.
Practice Excercise Practice now
Single Line Comments
Single line comments start with --
.
Any text between -- and the end of the line will be ignored (will not be executed).
The following example uses a single-line comment as an explanation:
Example
SELECT * FROM Customers;
The following example uses a single-line comment to ignore the end of a line:
Example
The following example uses a single-line comment to ignore a statement:
Example
SELECT * FROM Products;
Practice Excercise Practice now
Multi-line Comments
Multi-line comments start with /*
and end with */
.
Any text between /* and */ will be ignored.
The following example uses a multi-line comment as an explanation:
Example
of all the records
in the Customers table:*/
SELECT * FROM Customers;
The following example uses a multi-line comment to ignore many statements:
Example
SELECT * FROM Products;
SELECT * FROM Orders;
SELECT * FROM Categories;*/
SELECT * FROM Suppliers;
To ignore just a part of a statement, also use the /* */ comment.
The following example uses a comment to ignore part of a line:
Example
The following example uses a comment to ignore part of a statement:
Example
OR CustomerName LIKE 'R%' /*OR CustomerName LIKE 'S%'
OR CustomerName LIKE 'T%'*/ OR CustomerName LIKE 'W%')
AND Country='USA'
ORDER BY CustomerName;
Practice Excercise Practice now
Products
Partner
Copyright © RVR Innovations LLP 2024 | All rights reserved - Mytat.co is the venture of RVR Innovations LLP