Question

SQL MS Acess

1. Display cid, clast, and cfirst for customers whose (last name starts with a “D” and has a “v” in the third position) or (first name ends with an “a”).

2. Display all the columns in Invoice for those invoices that have less than the average iprice.

3. Display all the columns in Customer for those customers who purchased a vehicle that has the same date value in icontract and isold. In other words, customers who signed a contract and completed the sale of a vehicle on the same day so they could drive it home that same day.

4. Display all the columns in Employee for those employees who sold at least one vehicle within 7 days of being hired.

5. Display all the columns in Customer for those customers that have relationships but have never been a purchaser. In other words, formed one or more relationships with dealerships shopping for a car, but never became a purchaser by buying one.

6. Display all the columns in Employee for those employees who sold at least one vehicle owned by a dealership that is different from the dealership they work for.

7. Display all the columns in Dealership whose employees collectively sold more than $200,000 worth of vehicles in the month of February, 2018. The $200,000 limit could be exceeded by just one employee, or by a team of employees working at the same dealership each selling less than $200,000 individually; either case is valid.

8. Display all the columns in Invoice for those invoices with the 3 lowest unique iprice values. Note that there may be more than one invoice for each of the 3 lowest iprice values.

9. Display all the columns in Vehicle for those vehicles sold two or more times and at least one resale price is more than the first (initial) sale price.

10. Display vvin, vyear, vmake, vbody, vcolor, cid, clast, cfirst, cmi for those customers who purchased the same vehicle more than once.

» Relationships Invoice inum ieid vin icontract isold iprice Purchaser pinum pcid Employee eid edcode elast efirst emi ehire esalary estreet ecity estate ezip Vehicle win 3 vdcode Customer Dealership dcode dname dstreet dcity dstate dzip vmake cid clast cfirst cmi cstreet ccity cstate czip vweight vcylinders Relationship rdcode rcid Ready NUM LOCK

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer 1:

select cid,clast,cfirst from Customer where (clast like 'D_v%') or (cfirst like '%a');

Answer 2:

select * from Invoice where iprice < (select avg(iprice) as avgPrice from Invoice group by inum;);
-----------------------------------------

Answer 3:

select cr.* from Customer cr
inner join (select pr.pcid as pcid from Purchaser pr
inner join Invoice in on in.inum = pr.pinum
where in.icontract=in.isold;) tmp
on cr.cid = tmp.pcid;

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

Answer 4:

select emp.* from Employee emp
inner join (select in.ieid as eid from Employee emp
inner join Invoice in
on emp.eid = in.ieid where (in.isold-emp.ehire)<7 group by in.ieid having count(*)>0;) tmp on tmp.eid = emp.eid;
----------------------------------------------------------------

Answer 5:

select cst.* from Customer cst
inner join (select rsp.rcid as rcid from Relationship rsp
left outer join Purchaser pr on rsp.rcid = pr.pcid
where pr.pcid is null;) tmp on tmp.rcid = cst.cid;
-----------------------------------------------------------------------------------------------------

Answer 6:

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

Answer 7:

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

Answer 8:

select in1.* from Invoice in1
inner join (select inum from Invoive group by inum having count(distinct iprice)>=3;) in2
on in1.inum = in2.inum;
-----------------------------------------

Answer 9:


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

Answer 10:

select vc.vvin,vc.vyear,vc.vmake,vc.vbody,vc.vcolor,cst.cid,cst.clast,cst.cfirst,cst.cmi from Customer cst
inner join (select pr.pcid,in.ivin from Invoice in
inner join Purchaser pr on pr.pinum = in.inum
group by pr.pcid,in.ivin having count(*)>=1;) tmp on tmp.pcid=cst.cid
inner join Vehicle vc on vc.vvin = tmp.ivin;

Add a comment
Know the answer?
Add Answer to:
SQL MS Acess 1. Display cid, clast, and cfirst for customers whose (last name starts with...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Need the SQL query for the questions below 1) Print the name of customers who do...

    Need the SQL query for the questions below 1) Print the name of customers who do not live in MPLS or Edina, have a loan with an amount of more than 500 in any branch of the bank but not in the France branch, and have one or more accounts only in the France branch. 2) Show the name of all Customers who have only one account with a balance of more than $1000 in any branch of the bank...

  • Write a SQL query that shows the price of each order made by customers whose last name starts wit...

    Write a SQL query that shows the price of each order made by customers whose last name starts with the letter M. Display the order number, the last name on the order, and the price of the order (Order Price). Show the results with the highest order price first. Write a SQL query that determines the most expensive item purchased in each order (Item Price). Display the order number, the date of the order, the last name of the customer...

  • Using the database: Write SQL queries for each of the questions below. 1. Find the media...

    Using the database: Write SQL queries for each of the questions below. 1. Find the media type which has 100 or more tracks. Print the name of such media type. Number of rows returned in the result = 3 A) Find the playlists which have one or more tracks that have never been purchased in California (CA). Print the Id, and the name of such playlists. Number of rows returned in the result = 18 B) Find the customers who...

  • can someone solve these quick please and thank you! sql chapter 4 Query #1: List the...

    can someone solve these quick please and thank you! sql chapter 4 Query #1: List the company name, contact name, contact title and the phone number for customers who HAVE NOT put in an order. Use an outer join. Query #2: Create a listing displaying the employee first name, last name and the full name (First name space Last Name) of the person they report to (Supervisor). This is a self-join. If an employee does not report to anyone then...

  • #1) Display Last Name, First Name, DonorId, Fundname, TotalPledged from the donor’s database (you may need...

    #1) Display Last Name, First Name, DonorId, Fundname, TotalPledged from the donor’s database (you may need to use donor and pledge tables to get the information) for Donor ID 59034. (Your results window should have 3 rows) #2) Display all records from the PurchaseOrderHeader from the AdventureWorks Database that were sold by Employee 261 (Your results window should have 401 rows) #3) Display salesorderid, orderdate, totaldue, and territory name from salesorderheader and salesterritory for all totaldue that are greater than...

  • This code must be in SQL - Run the script provided with the assignment. This will...

    This code must be in SQL - Run the script provided with the assignment. This will create the tables used for this assignment. Write the necessary SQL commands to perform the required actions. Run the queries to obtain results from the database. (Make sure all columns returned have proper headings.) 3 2 In a single row show the following values: how many unique manufacturers are in the products table. What is the most expensive price per unit in the products...

  • There are 7 problems that require using joins. Each problem has 10 points. 1. Write an...

    There are 7 problems that require using joins. Each problem has 10 points. 1. Write an SQL command that will find any customers who have not placed orders and sort them out by CustomerID in ascending order. 2. List the employees and supervisors names for each supervisor who supervises more than two employees. 3. List the name of each employee, his or her birth date, the name of his or her manager, and the manager’s birth date for those employees...

  • Please refer to the following business scenarios: (i) Using SELECT statements of SQL, find the employee...

    Please refer to the following business scenarios: (i) Using SELECT statements of SQL, find the employee id, first name, last name, job title and email of all employees working in Asia (i.e. all countries coming from the region     ‘Asia’). This query must be implemented as a nested query! (ii) Using SELECT statements of SQL, find the employee id, first name, last name, job title and supervisor id of employees who had worked for more than 3 years and completed...

  • 2.7: Developing Your Business Etiquette COMMUNICATING ACROSS CULTURES Whose Skin Is This, Anyway? Generational differences abound in the workplace, but few are quite as visible as body art: tat...

    2.7: Developing Your Business Etiquette COMMUNICATING ACROSS CULTURES Whose Skin Is This, Anyway? Generational differences abound in the workplace, but few are quite as visible as body art: tattoos, piercings (other than ear lobes), and hair dyes in unconventional colors. According to survey data from the Pew Research Center people younger than 40 are much more inclined than those older than 40 to display some form of body art. For example, people 26 to 40 years old are four times...

  • Use SQL to slove the problem 1. (7) List all condos in building C, the date...

    Use SQL to slove the problem 1. (7) List all condos in building C, the date they were cleaned, and the full name of the staff who cleaned them in August. 2. (5) Display the activities reserved in June for more than 3 people. Include the activity description and label the output as Activities Reserved in June. 3. (4) Listing for all guides and their certification renewal dates for next year. Include full name and hire date. 4. (6) Management...

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