Question

In: Computer Science

List customer id, customer full name (Last name, full name, state) for those customers that have...

List customer id, customer full name (Last name, full name, state) for those customers that have ordered more than once.

List customers (order id, customer id, and customer last name) that had more than 2
-- products in their order. Order your result based on customer id followed by order id

SQL SERVER DATABASE

Solutions

Expert Solution

1)

Solution)

SELECT c.customerId,CONCAT(c.customerLastname," ",c.customerFirstname) AS customerFullname,c.state FROM customer c WHERE customerId IN ( SELECT customerId FROM order GROUP BY customerId HAVING COUNT(*) > 1);

Explanation:Subquery is used to fetch the records from order table that have more than one customerId and then select that records from the customer table using the In.

2)

Solution)

SELECT o.orderId,c.customerId,c.customerLastname FROM customer c INNER JOIN order o ON c.customerId=o.customerId WHERE o.quantity>2 ORDER BY c.customerId,o.orderId;

Explanation:I have used inner join on customer and order to find the matching customer id and have used the where clause to find order having quantity greater than 2 and order the result by customerId and orderId

NOTE:Please change the column names as you have not provided them correctly and please upvote if you liked my answer and comment if you need any modification or explanation.


Related Solutions

Create a program that allows a user to input customer records (ID number, first name, last...
Create a program that allows a user to input customer records (ID number, first name, last name, and balance owed) and save each record to a file. When you run the main program, be sure to enter multiple records. Once you create the file, open it and display the results to the user Save the file as  CustomerList.java
Problem: Read the following tables and answer the following questions: Customers Customer ID Name Address Phone...
Problem: Read the following tables and answer the following questions: Customers Customer ID Name Address Phone Email 9087 John Doe 204 University Ave. 987-098-9087 [email protected] 2098 Bill Lawrence 123 Jones St 717-387-3387 Business 2398 Laura Smith 0900 West Blvd. 901-234-4567 Information Transactions Customer ID Account Number Date of Last Transaction 9087 375 01/31/98 2098 123 03/09/97 2398 375 09/21/97 2098 375 12/31/97 2398 123 02/01/98 Accounts Account Number Balance Account Type 375 234.45 Checking 123 056.90 Savings 1. Who owns...
SQL statmen: List the first name, the last name, the address, the city, the state, the...
SQL statmen: List the first name, the last name, the address, the city, the state, the branchNo, and the email of agents working in the branch B005 and having email addresses ending with extensions different from .com.
Employee ID First Name Last Name email Title Address Extension Department Department ID Hiring Date Department...
Employee ID First Name Last Name email Title Address Extension Department Department ID Hiring Date Department Phone # 0001 John Smith jsmith Accountant 1300 West st 5775 Accounting 2100 8/1998 407-366-5700 0002 Brian Miller badams Admin Assistant 1552 Palm dr 5367 Human resource 2300 4/1995 407-366-5300 0003 James Miller miller Inventory Manager 2713 Buck rd 5432 Production 2520 8/1998 407-366-5400 0004 John Jackson jackson_sam Sales Person 433 tree dr 5568 Sales 2102 6/1997 407-366-5500 0005 Robert Davis Davis Manager 713...
List Customer and Product Without Sale In one list return, all customers who do not have...
List Customer and Product Without Sale In one list return, all customers who do not have an invoice and all products that were not sold. Use the UNION operator in this query. Return 3 values: - category - Is this line related to "customer" or "product"? Print "customer" or "product" without quotes. - id - customer.id (category="customer") or product.id (category="product") - name - customer.customer_name (category="customer") or product.product_name (category="product") Table definitions and a data sample are given below. Schema Table: customer...
Write a Java program for a restaurant with the following features: ◦ Customer: Name, Surname, ID...
Write a Java program for a restaurant with the following features: ◦ Customer: Name, Surname, ID (incremental ID by 1 for each new customer), Email, Phone, Address. ◦ Service: ID (incremental ID by1 for each group),CustomerID, Priority (High, Medium, Low, Other), ResolutionTimeFrame (Measured in Man hours), AssignedUser, Status(resolved or not), Fee. ◦ User (simple user of system): ID, Name, Surname, Username and Password (insert from code five fixed users), Address , PhoneNumber ◦ Manager: Name, Surname, Username and Password (insert...
List department name, employee id, and employee name for all employees in department name order. Repeat...
List department name, employee id, and employee name for all employees in department name order. Repeat for department #10 only. List the course ID, course name, section, instructor name, day, time, and room for all course sections. List the course ID, course name, section, student ID, and student name for CRN 1003. Display the list in ascending order of student last and first names. DROP TABLE registration; DROP TABLE sections; DROP TABLE courses; DROP TABLE students; DROP TABLE instructors; CREATE...
Return the full names (first and last) of actors with “SON” in their last name, ordered...
Return the full names (first and last) of actors with “SON” in their last name, ordered by their first name. Find all the addresses where the second address (i.e. address2) is not empty (i.e., contains some text), and return these second addresses sorted. Your Professor wants you to find all the information from rental table associated with those staff (or staff ID) whose address ID is 4 (in staff table). Professor wants you to use Sub-query function. Your Professor wants...
How many customers purchased more than 1 product? (Hint: Customer ID stays the same per customer...
How many customers purchased more than 1 product? (Hint: Customer ID stays the same per customer when he/she buys several food boxes) Please Tell me the steps on how this would be solved using Excel. Note that this is not the full excel data but just a small sample. date_sign_up customer_id product_name marketing_channel City 4/17/2015 13:11 71041 Classic - 3 meals per week for 2 people Search Engine Marketing San Diego 4/14/2015 11:32 103289 Classic - 3 meals per week...
We plan to develop customer’s database that stores customer’s number (ID), first name, last name and...
We plan to develop customer’s database that stores customer’s number (ID), first name, last name and balance. The program will support three operations: (a) reading and loading customer’s info from the text file, (b) entering new customer’s info, (c) looking up existing customer’s info using customer’s number(ID), (d) deleting the customer’s info and (e) the updated database will be stored in the text file after the program terminate. Customer’s database is an example of a menu-driven program. When the program...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT