Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Practice using these four tables, what are the best queries for MySQL according to the situational scenarios? (FIRST IS DONE FOR YOU) Table - Customer

Practice using these four tables, what are the best queries for MySQL according to the situational scenarios? (FIRST IS DONE FOR YOU)

Table - Customer

CustomerID - Primary Key

CustomerFirstName

CustomerLastName

CustomerPhone

AnnualIncome

CreditRating

Table - Encounter

EncID - Primary Key

SalesPersonID - Foreign Key

CustomerID - Foreign Key

EncDate

Purchase (Yes or blank)

Table - Salesperson

SalesID - Primary Key

SalesFirstName

SalesLastName

SalesHireDate

SalesSalary

Tabel - Credit Rating

CreditID Primary Key

CreditDescription

MinFico

MaxFico

Comments

---------------------------------

a. Practice creating a list of customers with annual incomes greater than $65,000 that purchased a car. Purchase will have a value of Yes.

SELECT CustomerLastName, CustomerFirstName FROM Customer, Encounter WHERE AnnualIncome >=65000 AND Purchase LIKE "Yes" AND customer.customerID=encounter.customerID;

1. Practice creating a query where, customers purchased vehicles despite having a Poor, Very Poor, or Extremely Poor credit rating? Show the first name, last name, and credit description for these

customers.

2. Practice creating a query where, Salesperson Thomas recently worked with a customer who he would like to contact again. Unfortunately, he cannot quite remember if the customer's last name was Allen or Ellen. Construct a query to help Thomas find the correct customer to follow up with.

Show the customer's first name, last name, and phone number.

3.Practice generating a query to find the average income of customers who purchased a car on their

interaction

4.Practice constructing a totals query to examine the relationship between salespeople and the annual income of the customers they target in their interactions. Show the salespeople's first name

and the average annual income of their customers in your result. You do not need to

include a criterion for Purchase in this query.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions