Developing By Me

Project Development and Design



The WHERE clause is the last of the widely used clauses since it limits the number of rows to be returned. This is a simple logic statement similar to the joining of the tables however it can be used to reference any value which include table fields, literals and variables. Each of these can be modified or adjusted to change the resulting dataset. The WHERE clause can contain multiple limiting values through the usage of AND and OR. The following is the basic syntax for the WHERE clause:


SQL Syntax Description
WHERE table1.field1 = ‘123456’ Returns all rows that table1.field1 matches the exact literal value of 123456
WHERE table1.field2 = 587458 Returns all rows that table1.field2 matches the number 587458
WHERE table1.field1 = ‘123456’AND table1.field2 = 587458 Returns only the rows that have both the matching literal and the matching number in the respective fields.
WHERE table1.field1 = ‘123456’OR table1.field2= 587458 Returns any row that has the specified literal or the matching number. Using ORs expands the dataset which can make it quite large if used incorrectly

%d bloggers like this: