Question

MYSQL Applied Database I just want to make sure that the syntax looks okay for my...

MYSQL Applied Database

I just want to make sure that the syntax looks okay for my database SQL statements, any help would be much appreciated:

1.A query that asks for customer star review for Tony Stark on Opportunity Detail.

SELECT CONCAT (employee_first_name,' ',employee_last_name) AS    

                       employee_name, review_star_count,

FROM customer_reviews,

JOIN e employees ON employee_id =employee_id,

WHERE employee_id=4 AND opportunity_id=1;

2.A query that shows how many orders Additional Dot Twain License, in an order totaling over $900.

SELECT product_name, COUNT(o.OrderID) AS OrderCount,

total_price,

FROM Customers c

JOIN orders o ON c.customer_id = o.customer_id

JOIN order_items oi ON o.order_id = oi.order_id

WHERE ItemPrice > 900

GROUP BY product_name

HAVING COUNT(o.order_id) > 1

ORDER BY total_price DESC;

3.A query that produces a list of catering costs for the company that are over $150 between the dates of 1-1-2018 to 12-31-2018.

SELECT invoice_total, vendor_name

FROM invoices i

JOIN vendors v ON i.vendor_id=v.vendor_id,

WHERE invoice_total>150

BETWEEN 1-1-2018 AND 12-31-2018

GROUP BY vendor_name;

4.A query that shows which employees have been on more than one opportunity detail.

SELECT CONCAT(employee_first_name,' ', employee_last_name) AS employee_name, opprotunity_id

FROM employees e

JOIN opportunity o ON o.opprotunity_owner=e.employee_id

WHERE o.opprotunity_owner >1;

5.A query that shows when the company's intern was hired.

SELECT CONCAT (hire_month,' ', hire_year) AS employee_hire_date, CONCAT (employee_first_name,' ',employee_last_name)AS employee_name

FROM employee

WHERE employee_id=6;

6.A query that shows the total amount spent on rent for the year 2017

SELECT SUM(payment_total)

FROM invoice_archive

WHERE vendor_id=4;

7.A query that asks how many employees are in the sales department

SELECT department_name,

(SELECT COUNT(*),

FROM employees e,

WHERE e.department_id=department_id) AS employees_number,

FROM department;

8.A query that shows which customers have ordered more than one product (that's not specialized)?

SELECT customer_business_name

COUNT(DISTINCT oi.product_id) AS number_of_products

FROM customers c

JOIN orders o ON c.customer_id = o.customer_id

JOIN order_items oi ON o.order_id = oi.order_id

HAVING COUNT(DISTINCT oi.product_id) > 1

ORDER BY customer_business_name;

9.A query that shows the closing date for each opportunity

SELECT opprotuniyt_id, closing_date

FROM opportunity

GROUP BY opportunity_id;

10.A query that shows all products for Nelson and Murdock Law Offices

SELECT customer_business_name, product_name

FROM order_items oi

JOIN products p ON p.product_code=oi.product_code

JOIN orders o ON o.order_number=oi.order_number

JOIN customers c ON c.customer_account_number = o.customer_account_number

GROUP BY customer_business_name, product_name

HAVING COUNT(product_code);

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
MYSQL Applied Database I just want to make sure that the syntax looks okay for my...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • I need help with the following problem: Using the classicmodels database you installed from Module 1,...

    I need help with the following problem: Using the classicmodels database you installed from Module 1, provide an example query using both a group by clause and a having clause. Show no more than ten rows of your query result. Discuss if the query you wrote can be rewritten without those clauses. I have come up with the following for the first part of the question: mysql> select offices.city, count(employees.employeenumber) as NumberOfEmployees from Employees -> inner join offices on offices.officecode...

  • Use MySQL Workbench to do the two task, for each task, run and then take a...

    Use MySQL Workbench to do the two task, for each task, run and then take a screenshot. Task 1: Example: You want to keep track of all the customers that live in area 615 and are issued more than 1 invoice. It has a long query!! How about putting it in the view. CREATE VIEW CUSTOMERS_OF_615 AS SELECT CUSTOMER.CUS_CODE, COUNT(INV_NUMBER) AS INVOICE_COUNT FROM CUSTOMER JOIN INVOICE USING (CUS_CODE) WHERE CUSTOMER.CUS_AREACODE = 615 GROUP BY CUSTOMER.CUS_CODE HAVING INVOICE_COUNT >1 A VIEW...

  • Which SQL statement retrieves the EmployeeName and City columns from the Employees table? O LIST EmployeeName,...

    Which SQL statement retrieves the EmployeeName and City columns from the Employees table? O LIST EmployeeName, City ON Employees; O FIND EmployeeName, City ON Employees; SELECT EmployeeName, City FROM Employees; O RETRIEVE EmployeeName, City FROM Employees; Which SQL statement finds the different cities in which national parks reside with no duplicate rows listed? SELECT DISTINCT city FROM natlpark ORDER BY city; O ORDER BY natlpark DISTINCT city; O ORDER BY city FROM natlpark; O SELECT city FROM natlpark ORDER BY...

  • You will develop an E-Commerce database used to maintain customers, products and sales information. You are...

    You will develop an E-Commerce database used to maintain customers, products and sales information. You are required to 1) gather and analyze requirements 2) design logical structure of the database 3) create stored procedures to develop the tables and insert the data 4) write SQL statements for data extraction and reporting. Throughout the course of this semester you have analyzed the requirements for an eCommerce database, designed and developed your database. As a class we have gone through the process...

  • K3 K3 School of CS & IT, RMIT Introduction to Database Systems Tutorial Sheet 2: SQL...

    K3 K3 School of CS & IT, RMIT Introduction to Database Systems Tutorial Sheet 2: SQL The database below is for a department store, and describes stock, staff, clients, and sales. Each question in this tutorial concerns this "store" database. SALE ITEM ITEM STAFF NUMSOLD CLIENT SDATE TYPE DESCRIP PRICE K3 Simon 6 Clark 19980311 Knife set $17.95 K11 Simon Cilla 19980121 K5 Ladle $6.95 K11 Simon Cilla 19980123 K11 Scraper $0.95 L12 Sorcha 5 Charles 19971130 L12 Rack $22.95...

  • Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a...

    Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a database that stores information abhout Hotel Management System. Customer (C email, name, country) Payment (Invoice id. C email, payment method, date) Invoice (Invoice id, starus, invoice description) Has (Bill id, Invoice id) Bill (Invoice id, Bill id, amount, Bname, type, date, reservation id) Reservation (Hotel id., room id. C email, date, period, reservation id) Rooms(Hotel id, room id. price, category) lotel (Hotel id, H...

  • Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a...

    Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a database that stores information abhout Hotel Management System. Customer (C email, name, country) Payment (Invoice id. C email, payment method, date) Invoice (Invoice id, starus, invoice description) Has (Bill id, Invoice id) Bill (Invoice id, Bill id, amount, Bname, type, date, reservation id) Reservation (Hotel id., room id. C email, date, period, reservation id) Rooms(Hotel id, room id. price, category) lotel (Hotel id, H...

  • Here is the P4 university database ---Drop tables --Drop Table FACULTY Cascade Constraints; --Drop Table OFFERING...

    Here is the P4 university database ---Drop tables --Drop Table FACULTY Cascade Constraints; --Drop Table OFFERING Cascade Constraints; --Drop Table STUDENT Cascade Constraints; --Drop Table COURSE Cascade Constraints; --Drop Table ENROLLMENT Cascade Constraints; Create Table STUDENT( Std_ID NUMBER(3) Constraint Student_STD_ID_FK PRIMARY KEY, Std_FN Varchar2 (9), Std_LN Varchar2 (8) , Std_City Varchar2 (10), Std_State Varchar2 (4), Std_Zip Number (5), Std_Major Varchar2 (6), Std_Class Varchar2 (3), Std_GPA NUMBER (3,2)); ---Insert records into Student Insert Into STUDENT Values( 101, 'Joe', 'Smith','Eau Clare','WI',18121,'IS','FR',3.8); Insert...

  • I need a response in your opinion, from this answer Q1. Any user accessing the database is more i...

    I need a response in your opinion, from this answer Q1. Any user accessing the database is more interested in quick and correct result than how a database is designed. Hence if we introduce redundancy in the table and if the performance of the query increases, then we can ignore 3NF. This is known as denormalization. In this process, a normalized table will be rejoined to have the redundancy in the table to increase the performance of the query. Denormalization...

  • Summarize these pages in your own style and you have to include in your report some...

    Summarize these pages in your own style and you have to include in your report some figures highlighting the relation between these operations. Basic AGGREGATE functions (Revision) COUNT: returns the number of tuples, which meet the specified condition: SELECT COUNT(DISTINCT Dept) AS Num_Depts FROM subject: SUM: returns the sum of the values in a specified column (i.e. numeric column) SELECT COUNT(*) AS hi_sal, SUM(salary) FROM Lecturer WHERE Salary > 4500 MIN: returns the minimum value in a specified column (numeri...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT