Question: SQL query help, please use the attributes name as it used on my db. 1.Write a query that answers this question: Which customer has more
SQL query help, please use the attributes name as it used on my db.

1.Write a query that answers this question: Which customer has more than 2 completed orders? Return the following:
-Name of the Customer
-the total number of orders for each customer
Use a DERIVED table in your logic
2.Write a query to illustrate the use of a subquery as a source in a JOIN
Return each service that has a promotion
-----------------------------
Thank you in advance!
\begin{tabular}{|l|l|} \hline \multicolumn{2}{|c|}{ PAYMENT } \\ \hline PK & PaymentID \\ \hline & PaymentType \\ AccountNum \\ RoutingNum \\ CreditCardNum \\ CCExpDate \\ CCSecurityNum \\ Status \\ CreatedDate \\ \hline \end{tabular} \begin{tabular}{|l|l|} \hline \multicolumn{2}{|c|}{ PROMO_SVC } \\ \hline PK & PromeServID \\ \hline FK & ServicelD \\ FK & PromoCode \\ & CreatedDate \\ \hline \end{tabular} \begin{tabular}{|l|l|} \hline \multicolumn{2}{|c|}{ PROMOTION } \\ \hline PK & PromoCode \\ \hline & PromoDescriptionStartDateEndDateStatus \\ \hline \end{tabular} \begin{tabular}{|l|l|} \hline \multicolumn{2}{|c|}{ INVOICE } \\ \hline PK & InvoicelD \\ \hline FK & CustomerID \\ FK & OrderID \\ FK & EmployeelD \\ & SubTotal \\ TaxAmount \\ TotalAmount \\ InvoiceDate \\ \hline \end{tabular} \begin{tabular}{|l|l|} \hline \multicolumn{2}{|c|}{ CATEGORY_SVC } \\ \hline PK & CategoryID \\ \hline & CategoryName \\ \hline \end{tabular} CellPhone Title DateOfHire
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
