In Postgresql comments can appear on a single line or span across multiple lines. Let see how to insert a single line and multi line comment in postgresql with example for each.
Single Line comment in Postgresql:
The syntax for creating a single line comment in PostgreSQL using — symbol:
— comment goes here
Multiline Line comment in Postgresql:
The syntax for creating a multi line comment in PostgreSQL starts with /* and ends with */ symbol:
/* comment
goes
here */
Example – Single line comment in Postgresql
You can create a SQL comment on a single line in PostgreSQL as shown below
-- selecting everything from Table1 Select * from Table1;
Or
/* selecting everything from Table1 */ Select * from Table1;
Example – Multi line comment in Postgresql
You can create a SQL comment on multiple lines in PostgreSQL as shown below
/* selecting everything from Table1 Author: Datasciencemadesimple.com */ Select * from Table1;