How do I create a query that includes first name, last name, email and state for all customers and prospects that includes an additional column what contains the letter "C" for customer or "P" for prospects in SQL?
How do I create a query that includes first name, last name, email and state for all customers and prospects that includes an additional column what contains the letter "C" for customer or "P" for prospects in SQL?
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
How do I create a query that includes first name, last name, email and state for all customers and prospects that includes an additional column what contains the letter "C" for customer or "P" for prospects in SQL?

Transcribed Image Text:CUSTOMER# LASTNAME FIRSTNAME ADDRESS
1001 MORALES BONITA
1002 THOMPSON RYAN
1003 SMITH
LEILA
THOMAS
1004 PIERSON
1005 GIRARD
CINDY
1006 CRUZ
MESHIA
1007 GIANA
TAMMY
KENNETH
1008 JONES
1009 PEREZ
JORGE
JAKE
1010 LUCAS
1011 MCGOVERN REESE
1012 MCKENZIE WILLIAM
1013 NGUYEN
1014 LEE
NICHOLAS
JASMINE
STEVE
1015 SCHELL
1016 DAUM
MICHELL
1017 NELSON
BECCA
1018 MONTIASA
GREG
1019 SMITH
1020 FALAH
JENNIFER
KENNETH
P.O. BOX 651
P.O. BOX 9835
P.O. BOX 66
69821 SOUTH AVENUE BOISE
P.O. BOX 851
SEATTLE
82 DIRT ROAD
ALBANY
9153 MAIN STREET
AUSTIN
P.O. BOX 137
P.O. BOX 8564
114 EAST SAVANNAH
P.O. OX 18
P.O. BOX 971
357 WHITE EAGLE AVE. CLERMONT
P.O. BOX 2947
P.O. BOX 677
9851231 LONG ROAD
P.O. BOX 563
1008 GRAND AVENUE
CITY
EASTPOINT
FL
SANTA MONICA CA
TALLAHASSEE FL
ID
WA
NY
TX
WY
CA
GA
IL
MA
FL
WY
P.O. BOX 1151
P.O. BOX 335
CHEYENNE
BURBANK
ATLANTA
CHICAGO
BOSTON
CODY
MIAMI
BURBANK
KALMAZOO
MACON
STATE ZIP
FL
CA
MI
GA
MORRISTOWN NJ
TRENTON
NJ
32328
90404
32306
83707
98115
12211
78710
82003
91510
30314
60606
2110
34711
82414
33111
91508
49006
31206
7962
8607
REFERRED REGION
SE
W
SE
NW
NW
NE
1003 SW
N
1003 W
SE
N
NE
1006 SE
N
SE
1010 W
N
SE
1003 NE
NE
EMAIL
bm225@sat.net
tpier55@sat.net
cing101@zep.net
cruztop@axe.com
treetop@zep.net
kenask@sat.net
jperez@canet.com
reesemc@sat.net
will2244@axe.net
nguy33@sat.net
jaslee@sat.net
sschell3@sat.net
becca88@digs.com
greg336@sat.net
Kfalah@sat.net

Transcribed Image Text:ID
>
LNAME FNAME EMAIL
ADDRESS
1
Greer
Preston
758 East Old York Dr. PA
8 Indian Summer Lane GA
ND
NY
2 Alvarez Felix
3 Malone Mable
4 Leonard Dewey
5 Pierce Melinda
6 Webb Terry
7 Alesander Darnell
2 Woodsman Rd.
71 Linden Dr.
9028 Sierra Drive
9 High Point Drive
279 Bedford Street
FL
IL
OH
8 Tran
7641 Tunnel St.
VA
George avejam@hotmail.com
imbalazin@mac.com
9 Pena
Gustavo
407 Warren Dr.
PA
10 Salazar Marvin fanghorn@hotmail.com
MT
385 Pleasant Rd.
7641 Tunnel St.
11 Strickland Steven
AL
granboudl@outlook.com
mturn@live.com
12 Wong
1528 Snowbird Lane
NE
Valerie
13 Thomas Pierson
tompierson@yahoo.com
ID
69821 South Avenue
761 Talbot Court
495 Delaware St.
Phillip
Lorraine
SC
VA
P.O. BOX 1151
NJ
30 Surrey Court
MD
CT
mcspor@hotmail.com
kguyer@aol.com
jennio@yahoo.com
seanty@verizon.net
eunice@outlook.com
k.Falah@harvard.edu
zellur@icloud.com
gastown@outlook.com
miyopi@icloud.com
jasmineflower@outlook.com
915 Ocean St
P.O. BOX 355
NJ
21 Woodsman Court WI
William St.
FL
538 Pendergast Lane
NJ
P.O. BOX 2947
WY
weddragon@comcast.net 992 Riverside Street
CA
14 Blair
15 Wade
16 Jennifer Smith
17 Sparks Holly
18 Butler May
19 Kenneth Falah
20 Cannon Ross
21 Hampton Don
22 Marshall Freda
23 Jasmine lee
24 Hudson Marion
mxgiao@yahoo.com
sakush@yahoo.ca
firstprize@att.net
drezeth@me.com
debest@opline.net
crandalf@sbcglobal.net
bgarcia@optonline.net
Promotion Books Prospects Customers
STATE
ZIP
17042
30180
58078
10002
32174
60076
44012
22701
15301
59601
36330
68104
83707
29406
23666
7962
20874
6074
80607
53140
34231
7050
82414
90260
Expert Solution

Step 1
Query:-
SELECT first_name, last_name, email, state, CASE WHEN customer_type = 'Customer' THEN 'C' ELSE 'P' END AS customer_or_prospect FROM customers_prospects
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education