A string value is a sequence of characters such as a name, city, department, address, or product description. In SQL, string literals are commonly enclosed in single quotation marks. String values can be compared, filtered, combined, and transformed using SQL expressions and functions.
A large amount of business information is stored as text. Understanding how SQL handles strings is essential for filtering customers, employees, products, locations, and other textual information.
If the Department column contains text values such as Finance, HR, and IT, a query can filter employees by comparing the column with a string value.
SELECT
EmployeeName,
Department
FROM Employees
WHERE Department = 'Finance';
String values are used in customer names, employee names, addresses, departments, product categories, transaction statuses, and other business attributes.
- String values contain text characters.
- String literals are commonly enclosed in single quotes.
- Strings can be compared in conditions.
- Strings can be searched using LIKE.
- SQL provides functions for working with strings.
How are string values commonly written in SQL?
String literals are commonly enclosed in single quotation marks.
Give an example of a string value.
Examples include 'Finance', 'Mumbai', 'Employee', and 'Active'.