How to use Dollar Quoted Strings In SQL
Example: Let’s insert a record into the “employee” table with ID 6 and name “Mr’s Archana” using dollar-quoted strings, as we can saw the following query:
insert into employee values(6, $$Mr's Archana$$)
Output:
Explanation: When we need to add a value containing more number of apostrophe symbols, it becomes difficult to write the query since each of those must be doubled. So, PostgreSQL provides another way called, Dollar Quoted Strings where we enclose the value within the dollar symbols.
How to Insert a Value that Contains an Apostrophe in PostgreSQL?
When working with databases, it’s common to encounter situations where values contain special characters like apostrophes. PostgreSQL, a powerful open-source database system, provides several ways to insert values that contain apostrophes safely. In this article, we’ll explore different approaches to handle this scenario and ensure data integrity.
Contact Us