This SQLite tutorial explains how to use comments within your SQLite statements with syntax and examples.
Did you know that you can place comments within your SQLite statements? These comments can appear on a single line or span across multiple lines. Let’s look at how to do this.
There are two syntaxes that you can use to create a comment within your SQLite statement.
- Syntax Using — symbol(single line)
- — comment goes here
- When using the — symbol, the comment must be at the end of a line in your SQLite statement with a line break after it. This method of commenting can only span a single line within your SQLite and must be at the end of the line.
- Syntax Using /* and */ symbols(multiple lines)
- /* comment goes here */
- A comment that starts with /* symbol and ends with */ and can be anywhere in your SQLite statement. This method of commenting can span several lines within your SQLite.
- Single Line (Comment)
12SELECT CustomerName,City -- Author: SkhoLingua.comFROM Customers;
- Multiple Lines (Comment)
123456789101112SELECT CustomerName,City /* Author: SkhoLingua.com */FROM Customers;orSELECT CustomerName,City/** Author: SkhoLingua.com* Purpose: To show a comment that spans multiple lines* in your SQLite statement.*/FROM Customers;