Knowee
Questions
Features
Study Tools

Write a query to display the employee_id and department_id of the employees who works less than 50 percent_time. Display the records sorted in ascending order based on employee_id.

Question

Write a query to display the employee_id and department_id of the employees who works less than 50 percent_time. Display the records sorted in ascending order based on employee_id.

🧐 Not the exact question you are looking for?Go ask a question

Solution

Assuming you are using SQL, here is a step-by-step guide on how to write the query:

  1. Identify the table: The first step in writing a SQL query is to identify the table you are working with. In this case, it seems like you are working with an "employees" table.

  2. Identify the columns: Next, identify the columns you need to work with. In this case, you need the "employee_id", "department_id", and "percent_time" columns.

  3. Write the SELECT statement: Start your query with the SELECT statement, which is used to select data from a database. In this case, you want to select the "employee_id" and "department_id" columns.

  4. Write the FROM statement: After the SELECT statement, write the FROM statement to specify the table you are selecting data from. In this case, the table is "employees".

  5. Write the WHERE statement: The WHERE statement is used to filter records. In this case, you want to filter the records where "percent_time" is less than 50.

  6. Write the ORDER BY statement: The ORDER BY statement is used to sort the result-set in ascending or descending order. In this case, you want to sort the results in ascending order based on "employee_id".

Here is the final query:

SELECT employee_id, department_id
FROM employees
WHERE percent_time < 50
ORDER BY employee_id ASC;

This query will display the "employee_id" and "department_id" of the employees who work less than 50 percent time, sorted in ascending order based on "employee_id".

This problem has been solved

Similar Questions

Write a query to display the ename of employees working in 'HR' department and who draw an annual salary greater than 1000000. [Consider employees who work in multiple departments too]. Display the records sorted in ascending order based on employee ename.Note:1. Display all the ename of employees working in 'HR' department and having annual salary greater than 1000000.2. Use Joins. Tables involved are employee, works and department3. Order by is mandatory.

we have following relations:employees(employee_id,first_name,last_name,email,salary,department_id)departments(department_id,department_name,location_id)(1) Find the employees who have the highest salary.(2) Display all the employee name along with department name who are working neitherin ‘HR’ Department nor earns more than 50000.2

Write a query to display the ename of employee who draw the highest salary. In case of multiple records, display the records sorted in ascending order based on ename.

Write a query to find the department ids where more than 10 employees are working.Consider employee table has department_id as a foreign key

Consider the following EmployeeDetails table.You want to display the details of employees whose salary is more than the lowest salary of department having ID 10.To perform this task, which of the following query you can use the

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.