# Write a query to display the customer code, first name, and last name of all customers who have had at least one invoice completed by employee 83649 and at least one invoice completed by employee 83677. Sort the output by customer last name and then first name (Figure P7.52). FIGURE P7.52 CUSTOMERS WITH INVOICE FILLED BY EMPLOYEES 83649 AND 83677

### 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 52P
Textbook Problem
341 views

## Write a query to display the customer code, first name, and last name of all customers who have had at least one invoice completed by employee 83649 and at least one invoice completed by employee 83677. Sort the output by customer last name and then first name (Figure P7.52).FIGURE P7.52 CUSTOMERS WITH INVOICE FILLED BY EMPLOYEES 83649 AND 83677

Program Plan Intro

DISTINCT Keyword:

“DISTINCT” keyword is used to avoid redundant data (removing duplicate values) from a column. The syntax for “DISTINCT” keyword is as follows:

Syntax:

SELECT DISTINCT column_Name FROM table_Name;

INNER JOIN keyword:

“INNER JOIN” keyword is used to select all the matching records of both the table.

Syntax:

SELECT col_Name FROM table_Name1 INNER JOIN table_Name2 ON table_Name1.col_Name = table_Name2.col_Name;

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;

### Explanation of Solution

Query:

Query to display the customer details from the table, according to the given condition and sort the output by customer’s last name followed by customer’s first name as follows:

The below query was executed using the tool “Access 2013”.

SELECT DISTINCT sub1.Cust_Code, sub1.Cust_FName, sub1.Cust_LName

FROM (SELECT c.Cust_Code, Cust_FName, Cust_LName FROM lgcustomer AS c INNER JOIN lginvoice AS i ON c.cust_code = i.cust_code WHERE employee_id = 83649)  AS sub1 INNER JOIN (SELECT c2.cust_code, cust_fname, cust_lname FROM lgcustomer AS c2 INNER JOIN lginvoice AS i2 ON c2.cust_code = i2...

### 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
Explain why database design is important.

Database Systems: Design, Implementation, & Management

Which law amended the Computer Fraud and Abuse Act of 1986, and what did it change?

Principles of Information Security (MindTap Course List)

What is the result in aluminum alloys after solution heat treatment?

Precision Machining Technology (MindTap Course List)

Describe the role of a CIO within an organization.

Principles of Information Systems (MindTap Course List)

Calculate the heat-transfer rate through a 24 ft2 door with. U=0.75Btuhft2F The indoor and outdoor temperatures...

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

Is batch processing still relevant? Why or why not?

Systems Analysis and Design (Shelly Cashman Series) (MindTap Course List)

Mini discs require a separate mini disc drive; that is, they do not work in standard-sized optical disc drives....

Enhanced Discovering Computers 2017 (Shelly Cashman Series) (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)

Why are some propane and natural gas tips made with a deep, recessed center?

Welding: Principles and Applications (MindTap Course List)