Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have 2 different statements: SELECT custname FROM si.prospect WHERE carmake = carmake AND carmodel = carmodel INTERSECT SELECT custname FROM si.car WHERE carmake =

I have 2 different statements:

SELECT custname FROM si.prospect WHERE carmake = carmake AND carmodel = carmodel INTERSECT SELECT custname FROM si.car WHERE carmake = carmake AND carmodel = carmodel;

SELECT custname, carmake, carmodel FROM si.prospect INTERSECT SELECT custname, carmake, carmodel FROM si.car;

None of them seen to do what I want. First statement gives me output of people name that doesn't meet the criteria, while the second leaves out people that does meet the criteria. What I need is to display the list of customers that wants to buy the same car make and model that they already have.

DB SCHEMA:

image text in transcribed

CAR CUSTOMER custame VARCHAR2:20) Custstreet VARCHAR2(20) NOT NULL VARCHAR2(20) NOT NULL custprovince CHAR(2) NOT NULL DEFAULT ON custpostal CHAR(7) NOT NULL custhphone CHAR(13) NOT NULL cuslbphone CHAR(12) NOT NULL casera CHARIS SALEINV saleinno CHAR(6) saledate DATE NOT NULL salesman VARCHARZ/20NOT NULL custame VARCHAR2/20) NOT NULL carse CHARYA NOT NULL insfire CHAR(1) inscollision CHAR(1) insliability CHAR(1) insproperty CHAR(1) taxrate NUMBER(4.2) DEFAULT 13.0 licee NUMBER/62) discount NUMBER(82) commission NUMBER 8.2) carsalepnce NUMBER 9 2 SERVINV custame VARCHAR2(20) carmake VARCHAR2(10) NOT NULL cammodel VARCHAR2(10) NOT NULL CHAR(4) NOT NULL extcolour VARCHAR2(12) NOT NULL cartrim VARCHAR2(16) NOT NULL enginetype VARCHAR2(10) NOT NULL enginelype VARCHAR2(10) NOT NULL purchivne CHARIS) purchcest NUMBER(92) freightcost NUMBER(92) carlistprice NUMBER 9.2) PROSPECT custame VARCHAR2 (20) NOT NULL Carme VARCHAR2(10) NOT NULL carmodel VARCHAR2(10) canear CHAR (4) carcolour VARCHAR2(12) Sen CHARIS) servdate DATE NOT NULL custame VARCHAR2/20) NOT NULL carserial CHAR(S) NOT NULL parts.cost NUMBER(72)

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions