SQLite quote() function
Description
The quote(X) function returns a string which is the value of its argument suitable for inclusion into another SQL statement. Strings are surrounded by single-quotes with escapes on interior quotes as needed.
Syntax:
quote(X);
Argument:
Name | Description |
---|---|
X | A string. |
SQLite Version : 3.8.5
Example of SQLite quote() function
The following SQLite statement returns a string 'w3re' 'source'.
SELECT quote('w3re''source');
Here is the result.
Sample Output:
quote('w3re''source') ------------------------------ 'w3re''source'
Example of SQLite quote() function using table
Sample table: departments
The following statement returns the department_name and department_name enclosed with a single quote for those departments whose department_id is larger than 100.
SELECT department_name, quote(department_name)
FROM departments
WHERE department_id>150;
Here is the result.
Sample Output:
department_name quote(department_name) --------------- ---------------------- Marketing 'Marketing' Purchasing 'Purchasing' Human Resources 'Human Resources' Shipping 'Shipping' IT 'IT' Public Relation 'Public Relations' Sales 'Sales' Executive 'Executive' Benefits 'Benefits' Manufacturing 'Manufacturing' Construction 'Construction' Contracting 'Contracting' Operations 'Operations' IT Support 'IT Support' NOC 'NOC' IT Helpdesk 'IT Helpdesk' Government Sale 'Government Sales' Retail Sales 'Retail Sales' Recruiting 'Recruiting' Payroll 'Payroll'
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/sqlite/core-functions-quote.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics