write a sql query that returns Which states have more than one customer? List the states and the number of customers for those states. The list must not include the states that do not have more than one customer.
CUSTOMER_T
CustomerName, Street, City, State, Zip,
SELECT State, COUNT(State) as no_customers
FROM CUSTOMER_T
group by State having count(State) > 1;
We will use group by a statement to group the customers by the state which they are living in. After grouping using having clause, we will check whether the count of state (Which are grouped) is more than 1 or not. If it's more than one we will print that state and the number of customers as Count(state). From the table, we know that each row belongs to one unique customer
.
Write a sql query that returns Which states have more than one customer? List the states and the ...
write a SQL query for: For each product that was sold in more than one sales transaction, retrieve the ProductID value and the number of sales transactions in which the product was sold.
Write the sql statement that returns a list of store's cities and countries. Where are they located (city and country)? Show your results. Write the sql statement that returns the total revenue for those stores. Show your results including store number, city and country. Write the sql statement that returns the total revenue per year for those stores. Show your results including store number, city and country. Write the sql statement that returns the average revenue per month regardless of...
Deliverable 1. Simple SQL Statements Caution: Read the instructions carefully! Each question is based on a single SQL statement, and the single SQL statement might contain sub-queries (additional SELECT statements) within the statement. Provide a list all of the Customer ID, Customer Names, and States and sort the list in alphabetical order by Customer Name. Provide a list of all of the Customer ID, Customer Names, and States, and sort the list by state with the Customer Names in alphabetical...
Write the sql statement that returns a list of store's cities and countries. Where are they located (city and country)? Show your results. Write the sql statement that returns the total revenue for those stores. Show your results including store number, city and country. Write the sql statement that returns the total revenue per year for those stores. Show your results including store number, city and country. Write the sql statement that returns the average revenue per month regardless of...
2. SQL queries (40 points total, 5 points each query) Write SQL query statements to query the following Hotel Room Booking Database Tables. "cid" is Customer ID. "rid" is Room ID. "bid" is Booking ID. "dob" means Date of Vwwww Birth; "beds" means the number of beds in the room which is normally 1 or 2 beds. "DueDate" and "DueAmount" are the payment due dates and due amounts of this booking. Customers fname name phone email cid dob zipcode Rooms...
WRITE A SQL QUERY SQL SERVER Write a SELECT statement that returns one column from the Customers table named FullName that joins the LastName and FirstName columns. -- Format this column with the last name, a comma, a space, and the first name like this: -- Doe, John -- Sort the result set by last name in ascending sequence. -- Return only the contacts whose last name begins with a letter from M to Z. -- ...
List the names of the customer (or customers) who spent the greatest dollar amount in a single order.please give me an sql query for this question and i have tables as follows customer(customer_name,address,zipcode,customer_id,state),office_supplies(item_name,item_id,cost,category),orders(order_id,date,customer_id) order_details(quantity,order_id,item_id)
I need this written in SQL Employee EMP ID EMP FNAME EMP LNAME EMP STREET EMP CITY EMP STATE EMP ZIP EMP START DATE Table TABLE ID AREA IDTABLE SEATS Area AREA ID AREA NAME AREA SUPERVISOR EMPLOYEE ID Customer CUST ID CUST LAST NAME CUST NUMBER OF GUESTS Assignment EMPID TABLE ID Seating CUST IDTABLE ID SEATING COST SEATING DATE SEATING TIP Question 29 (10 points) Write an SQL query to list the employee ID and first and last...
Oracle Apex SQL Query: list the salesman that have a monthly salary greater than $1300
SQL queries and procedures TABLE: Employees Business Rules: EmployeeID is defined as the primary key. Address has been denormalized to include City and State for performance reasons. DeptNbr is a foreign key that references DeptNbr in the Department table Manager is a foreign key that references EmployeeID in the Employees table Data Structure: (EmployeeId, LastName, FirstName, Street, City, State, Zip, DateOfHire, DateOfBirth, JobTitle, Salary, DeptNbr(fk), Manager(fk)) TABLE: Department Business Rules: DeptNbr is defined as the primary key. Data Structure: (DeptNbr,...