Tuesday, June 16, 2015

sql in where

WHERE

To retrieve selected rows based on a specific condition, you need to use the WHERE clause in the SELECT statement. Using the WHERE clause selects the rows that satisfy the condition. The following SQL query retrieves the department details from the Department table, where the group name is Research and Development:
 SELECT * FROM HumanResources.Department WHERE GroupName = 'Research and Development'

The syntax for using comparison operators in the SELECT statement is:

 SELECT column_list FROM table_name WHERE expression1 comparison_operator expression2
where, expression1 and expression2

SELECT EmployeeID, NationalIDNumber, Title, VacationHours FROM HumanResources.Employee WHERE VacationHours < 5


No comments:

Post a Comment