0% found this document useful (0 votes)
27 views

WHERE Clause Quotes Around Text Fields: Operator Description

The WHERE clause in SQL queries allows filtering results by specifying conditions that rows must meet. Text values must be enclosed in single quotes, while numeric values should not be quoted. Common operators used in the WHERE clause include equals (=), not equals (<>), greater than (>), less than (<), greater than or equal (>=), and less than or equal (<=). The BETWEEN and LIKE operators can also be used to filter results.

Uploaded by

Satish Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

WHERE Clause Quotes Around Text Fields: Operator Description

The WHERE clause in SQL queries allows filtering results by specifying conditions that rows must meet. Text values must be enclosed in single quotes, while numeric values should not be quoted. Common operators used in the WHERE clause include equals (=), not equals (<>), greater than (>), less than (<), greater than or equal (>=), and less than or equal (<=). The BETWEEN and LIKE operators can also be used to filter results.

Uploaded by

Satish Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

WHERE Clause Quotes Around Text Fields

SQL uses single quotes around text values (most database systems will also accept double quotes). Although, numeric values should not be enclosed in quotes. For text values: This is correct: SELECT * FROM Persons WHERE FirstName='Tove' This is wrong: SELECT * FROM Persons WHERE FirstName=Tove For numeric values: This is correct: SELECT * FROM Persons WHERE Year=1965 This is wrong: SELECT * FROM Persons WHERE Year='1965'

Operators Allowed in the WHERE Clause


With the WHERE clause, the following operators can be used: Operator = Equal <> Not equal > Greater than < Less than >= Greater than or equal <= Less than or equal BETWEEN Between an inclusive range Description

LIKE IN

Search for a pattern If you know the exact value you want to return for at least one of the columns

Note: In some versions of SQL the <> operator may be written as !=

SELECT Row_Id, Company_Name, Address1, Contact_Person, Phone_No, Mobile_No, Mobile_No1, On_Date, FaxNo, User_Name, Password, My_User_Name, My_Mail_Id, PhoneNoCode FROM WHERE Tran_ElectricalBazar_Pages (Category_Id = '6')

You might also like