To find the top 5 most expensive items in the database, write a SQL query that orders the items by price in descending order.
To find the third highest salary in a table, you can use a SQL query. For example, given the following table: | ID | Name | Salary | |---- |-------|--------| | 1 | John | 1000 | | 2 | Jane | 2000 | | 3 | Joe | 3000 | | 4 | Sarah | 4000 | | 5 | Dave | 5000 | The third highest salary would be Joe's, with a salary of 3000.
This technical problem involves writing a SQL query to find the average salary of employees by department. The example input table includes columns for department, first name, last name, and salary. The expected output is a table with columns for department and average salary.
Write a SQL query to find the products that have been in stock for more than 365 days.
The problem is to write a query to return the average price of all products in an unnormalized database table. The table includes the attributes productID, productName, productDescription, and productPrice.
Given a database with two tables, Employees and Departments, this SQL query will find the names of all employees who work in the Sales department.
This technical problem deals with designing a social network database schema that includes posts, comments, and likes. The input is a set of CREATE TABLE statements for the three tables, and the output is sample data for those tables.
To find the customer with the highest balance, you can use a simple SQL query as follows: SELECT customer_id, name, balance FROM customers ORDER BY balance DESC LIMIT 1