Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. SQL Server
  3. Question
SQL Server

How can I write a SQL query for categorizing the salary of employees in SQL?

Asked by Daniel Baker Jan 17, 2024 1.5K views 1 answer
Share

About this question

 I am assigned a task which is related to analyzing data in SQL. In this task, there is a table whose name is “employees” with the following columns: “employee_id” “employee_name” and “salary”. How can I write an SQL query for categorizing employees' salaries based on the categories of low, medium, and high? Here are the following criteria:

  • If the salary is less than 30000 then it should be counted as low

  • If the salary is between 30000 and 60000 then it should be counted as medium

  • If the salary is above 60000 then it should be categorized as high. 

The query should retrieve the “employee_name” and their respective category.

Your answer

1 Answer

More SQL Server discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest SQL Server Blogs

Guides, tips and career advice on SQL Server from JanBask experts.