- Select all employee detail with First name "Tom" and "Lucy"
Answer: Select * from EmployeeDetail Where FirstName IN ('Tom','Lucy')
- Select all employee detail with First name Not "Frank" and "Jane”
Answer: Select * from EmployeeDetail Where FirstName NOT IN ('Frank','Jane')
- Select first name from "EmployeeDetail" table after removing white spaces from right side
Answer: Select RTRIM(FirstName) AS [First Name] From EmployeeDetail
- Select first name from "EmployeeDetail" table after removing white spaces from left side
Answer: Select LTRIM(FirstName) AS [First Name] From EmployeeDetail
Where EmpId=13
- Select first name from "EmployeeDetail" table prefixed with "Hi
Answer: Select 'Hi '+FirstName from EmployeeDetail
- Get employee details from "EmployeeDetail" table whose Salary greater than 70000
Answer: Select * from EmployeeDetail where Salary>70000
- Get employee details from "EmployeeDetail" table whose Salary less than 70000
Answer: Select * from EmployeeDetail where Salary<70000
- Get employee details from "EmployeeDetail" table whose Salary between 50000 than 60000
Answer: Select * from EmployeeDetail Where Salary Between 40000 AND 60000
Please refer below YouTube video for more detail explanation:
No comments:
Post a Comment