# Write a query to display the employee number, first name, last name, and largest salary amount for each employee in department 200. Sort the output by largest salary in descending order (Figure P7.40). FIGURE P7.40 LARGEST SALARY AMOUNT FOR EACH EMPLOYEE IN DEPARTMENT 200

### Database Systems: Design, Implemen...

13th Edition
Carlos Coronel + 1 other
Publisher: Cengage Learning
ISBN: 9781337627900

Chapter
Section

### Database Systems: Design, Implemen...

13th Edition
Carlos Coronel + 1 other
Publisher: Cengage Learning
ISBN: 9781337627900
Chapter 7, Problem 40P
Textbook Problem
57 views

## Write a query to display the employee number, first name, last name, and largest salary amount for each employee in department 200. Sort the output by largest salary in descending order (Figure P7.40).FIGURE P7.40 LARGEST SALARY AMOUNT FOR EACH EMPLOYEE IN DEPARTMENT 200

Program Plan Intro

ORDER BY Clause:

SQL contains “ORDER BY” clause in order to sort rows. The values get sorted in ascending as well as descending order. The keyword used to sort values in ascending order is “ASC” and for descending order is “DESC”. By default, it sorts values by ascending order.

Syntax:

SELECT column_Name1, column_Name2 FROM table_Name ORDER BY column_Name2;

GROUP BY Clause:

The GROUP BY clause is used to group the result of a SELECT statement done on a table where the tuple values are similar for more than one column

Syntax:

SELECT expression1, expression2, expression_n, aggregate_function (expression) FROM table_name WHERE conditions GROUP BY expression1, expression2, expression_n;

### Explanation of Solution

SQL code:

The SQL code to display the employee name, first name, last name and maximum of salary amount is given below:

SELECT E.EMP_NUM, EMP_FNAME, EMP_LNAME, Max(SAL_AMOUNT) AS LARGESTSALARY

FROM LGEMPLOYEE AS E, LGSALARY_HISTORY AS S

WHERE E.EMP_NUM = S.EMP_NUM

AND DEPT_NUM = 200

GROUP BY E.EMP_NUM, EMP_FNAME, EMP_LNAME

ORDER BY max(sal_amount) DESC;

Explanation:

• The above query is used to display the “EMP_NUM”, ...

### Still sussing out bartleby?

Check out a sample textbook solution.

See a sample solution

#### The Solution to Your Study Problems

Bartleby provides explanations to thousands of textbook problems written by our experts, many with advanced degrees!

Get Started

Find more solutions based on key concepts
Briefly explain the scrum process and how it works.

Fundamentals of Information Systems

Identify and briefly define six characteristics that describe the quality of data.

Principles of Information Systems (MindTap Course List)

Present Example 13.6 in Chapter 13 using the format discussed in Section 4.2. Divide the example problem into G...

Engineering Fundamentals: An Introduction to Engineering (MindTap Course List)

If your motherboard supports ECC DDR3 memory, can you substitute non-ECC DDR3 memory?

A+ Guide to Hardware (Standalone Book) (MindTap Course List)

What practices should gamers follow to increase their security? (216)

Enhanced Discovering Computers 2017 (Shelly Cashman Series) (MindTap Course List)

Why should you never change the current setting during a weld?

Welding: Principles and Applications (MindTap Course List)