Knowee
Questions
Features
Study Tools

Use a UNION to create a list of all the employee's and customer's first names and last names ordered by the last name in descending order.

Question

Use a UNION to create a list of all the employee's and customer's first names and last names ordered by the last name in descending order.

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

Solution

Sure, I can help with that. However, I need to know the structure of your tables to provide an accurate SQL query. Assuming you have two tables, employees and customers, and both of them have first_name and last_name columns, the SQL query would look like this:

SELECT first_name, last_name
FROM employees
UNION
SELECT first_name, last_name
FROM customers
ORDER BY last_name DESC;

Here's a step-by-step breakdown of the query:

  1. SELECT first_name, last_name FROM employees: This part of the query selects the first and last names of all employees.

  2. UNION: This keyword combines the results of two or more SELECT statements without returning any duplicate rows.

  3. SELECT first_name, last_name FROM customers: This part of the query selects the first and last names of all customers.

  4. ORDER BY last_name DESC;: This part of the query sorts the combined list of employees and customers by last name in descending order.

Please replace employees and customers with your actual table names, and first_name and last_name with your actual column names if they are different.

This problem has been solved

Similar Questions

Write a query to retrieve the names of all employees and sort them in ascending order.Table: EmployeeInput records:Input format :The input table is already created, and records are already prepopulated, as mentioned in the problem statement.Output format :The output displays the names of all employees in ascending order as shown below.NameAngelMarkMathewSteveRefer to the sample output for the column headers.

Which SQL statement will list the employee details inside the EMPLOYEE table order by last names in ascending order, if two employees have same last name order them by the employee first name in ascending order?Select one:a.​SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE     FROM EMPLOYEE          ORDER BY  EMP_LNAME ASC, EMP_FNAME DESC;​b.​SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE     FROM EMPLOYEE          LIST BY  EMP_FNAME, EMP_LNAME;​c.​SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE     FROM EMPLOYEE          ORDER BY  EMP_LNAME, EMP_FNAME;​d.​SELECT EMP_LNAME, EMP_FNAME, EMP_INITIAL, EMP_AREACODE, EMP_PHONE     FROM EMPLOYEE          ORDER BY  EMP_FNAME, EMP_LNAME;

Create Table Employee with attributes firstName,LastName,SSN,Address,Salary,Birthday,Sex,SupervisorSSN,DepartmentNo

Write a query to display the customer id, customer name, guardian name, reference account holders name of the customers who are referenced / referred by the relation 'NEIGHBOUR'(case-sensitive). Display the records sorted in ascending order based on customer id.

You are given a table Employee which has the following columns :id, FirstName, LastName.You have to use a query to display all those employees whose first names start with the letter ‘R’ and end with the letter ‘I’. Some queries are given below -(a) SELECT * FROM Employee WHERE FirstName LIKE '%RI%';(b) SELECT * FROM Employee WHERE FirstName LIKE 'R%' AND FirstName LIKE '%I';(c) SELECT * FROM Employee WHERE FirstName LIKE 'R' AND 'I';(d) SELECT * FROM Employee WHERE FirstName LIKE 'R%I';Choose the most appropriate option from below :Options: Pick one correct answer from belowOnly (c)Only (b)(b) and (d)(b), (c) and (d)(a) and (c)None of the above

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.