SlideShare a Scribd company logo
1) What are the names of customers who have sent packages (shipments) to Sioux City?
SQL> Selectcust_id,cust_name from CUSTOMERsss where cust_id in (select cust_id from
shipmentsss where destination = 'Sioux');
Ans:-no rows selected
2)To what destinations have companies with revenue less than $1 million sent packages?
SQL>select distinct(destination) from shipmentsss where cust_id in (select cust_id from
customersss where annual_revenue< 10000000);
DESTINATION
--------------London
Sioux City
Baltimore
Panama City
Rome
San Francisco
St.Louis
Los Angeles
Manhattan
Paris
10 rows selected.
3)What are the names and populations of cities that have received shipments weighing over
100 pounds?
SQL>select city_name,population from citysss where city_name in (select destination from
shipmentsss where weight > 100);
CITY_NAME

POPULATION

------------------------------ ---------London
Manhattan

100000000
10000000
Rome
San Francisco
Sioux City

200000000
20000000
5000000000

4)> select cust_id,cust_name from CUSTOMERsss where annual_revenue> 5000000 and
cust_id in ( select cust_id from shipmentsss where weight <1);

Ans:-no rows selected

5)selectcust_id,cust_name from customersss where annual_revenue>
5000000 and cust_id in (select cust_id from shipmentsss where weight < 1 or destination = 'San
Francisco');

Ans:-no rows selected

6)select truck_#,driver_name from trucksss where truck_# in (select truck_# from shipmentsss
where cust_id in
(select cust_id from customersss where annual_revenue>2000000) and destination in (select
city_name from citysss where population > 1000000));

TRUCK_# DRIVER_NAME
--------- -----------100 Jensen
102 Hrithik
101 Sasi
103 Jake Stinson
7)select distinct(destination) from shipmentsss where cust_id in ( select cust_id from
customersss where annual_revenue>1500000);

DESTINATION
--------------London
Baltimore
Panama City
San Francisco
Rome
St.Louis
Los Angeles
Manhattan
Paris

9 rows selected.

8)select truck_#,driver_name from trucksss where truck_# in (select truck_# from shipmentsss
where weight > 100);

TRUCK_# DRIVER_NAME
--------- -----------100 Jensen
102 Hrithik
103 Jake Stinson

9)selectcust_name,annual_revenue from customersss where cust_id in (select cust_id from
shipmentsss where weight > 100);

CUST_NAME

ANNUAL_REVENUE

-------------------- -------------Revathi

1000000

Richa

1800000

Rishi

1000000

Kalyan

4800000

10)selectcust_name,annual_revenue from customersss where cust_id in (select cust_id from
shipmentsss where truck_# in
(select truck_# from trucksss where driver_name = 'Jensen'));

CUST_NAME

ANNUAL_REVENUE

-------------------- -------------Revathi

1000000

Kalyan

4800000

Rijesh

4000000

11)selectcust_id,cust_name from customersss where ( select count(distinct(truck_#)) from
shipmentsss where
shipmentsss.cust_id = customersss.cust_id) >= (select count(*) from truck);
CUST_ID CUST_NAME
--------- -------------------100 Revathi
103 Rijesh
104 Kalyan

12)selectcity_name from citysss where (select count (distinct ( cust_id)) from shipmentsss where
destination = citysss.city_name) >= (select count
(*) from customersss);

Ans:no rows selected

13)selectdriver_name from trucksss where truck_# in (select truck_# from trucksss where (select
count(distinct(destination))
from shipmentsss where shipmentsss.truck_# = trucksss.truck_#) >= (select count (*) from
citysss));

Ans:- no rows selected

14)selectcust_id,cust_name from customersss where cust_type = 'manufacturer' or cust_id in
(select cust_id from shipmentsss where destination = 'St. Louis');

CUST_ID CUST_NAME
-------- -------------100 Revathi
15)selectcity_name from citysss where population > 1000000 and city_name in (select
destination from shipmentsss where weight = 100 and cust_id = 311);

Ans:- no rows selected

16)> select truck_# from trucksss where driver_name = 'Jake Stinson' and truck_# in (select
truck_# from shipmentsss where destination <> 'Denver');

TRUCK_#
---------103

17)selectcust_id,cust_name from customersss where annual_revenue> 10000000 and cust_id in
(select cust_id from shipmentsss where destination in
(selectcity_name from city where population < 10000) and weight < 1);

Ans:- no rows selected

18a)SQL> create view revenue_1 as select cust_id,cust_name from customerss where
annual_revenue< 1000000;

b)create view revenue_2 as select cust_id,cust_name from customersss where annual_revenue>
1000000 and annual_revenue< 5000000;

c)> create view revenue_3 as select cust_id, cust_name from customersss where
annual_revenue> 5000000;
19a)select * from revenue_3 where cust_id in (select cust_id from shipmentsss where destination
= 'Los Angeles');

More Related Content

Viewers also liked

Film Posters
Film PostersFilm Posters
Film Posters
josephineny
 
Dr Brendan O' Sullivan in Tinnitus Talk, March 2014
Dr Brendan O' Sullivan in Tinnitus Talk, March 2014Dr Brendan O' Sullivan in Tinnitus Talk, March 2014
Dr Brendan O' Sullivan in Tinnitus Talk, March 2014
Dr Brendan O'Sullivan
 
WHERE IS SINDH....A PETITION TO HON. PRIME MINISTER NARENDRA MODI
WHERE IS SINDH....A PETITION TO HON. PRIME MINISTER NARENDRA MODIWHERE IS SINDH....A PETITION TO HON. PRIME MINISTER NARENDRA MODI
WHERE IS SINDH....A PETITION TO HON. PRIME MINISTER NARENDRA MODI
BIREN SHAH
 
Jam dinding belajar
Jam dinding belajarJam dinding belajar
Jam dinding belajar
Azemi El'Kartie
 
Article from the british medical journal summary of nice ssi guidelines
Article from the british medical journal summary of nice ssi guidelinesArticle from the british medical journal summary of nice ssi guidelines
Article from the british medical journal summary of nice ssi guidelines
Arman Malekan Dr.
 
Naturals herbal Avon - Секреты родной природы для Вашей красоты
Naturals herbal Avon - Секреты родной природы для Вашей красотыNaturals herbal Avon - Секреты родной природы для Вашей красоты
Naturals herbal Avon - Секреты родной природы для Вашей красоты
Yury Buhalov
 
Anew - заряд энергии 25+
Anew - заряд энергии 25+Anew - заряд энергии 25+
Anew - заряд энергии 25+
Yury Buhalov
 
Sql queries with answers
Sql queries with answersSql queries with answers
Sql queries with answers
vijaybusu
 

Viewers also liked (8)

Film Posters
Film PostersFilm Posters
Film Posters
 
Dr Brendan O' Sullivan in Tinnitus Talk, March 2014
Dr Brendan O' Sullivan in Tinnitus Talk, March 2014Dr Brendan O' Sullivan in Tinnitus Talk, March 2014
Dr Brendan O' Sullivan in Tinnitus Talk, March 2014
 
WHERE IS SINDH....A PETITION TO HON. PRIME MINISTER NARENDRA MODI
WHERE IS SINDH....A PETITION TO HON. PRIME MINISTER NARENDRA MODIWHERE IS SINDH....A PETITION TO HON. PRIME MINISTER NARENDRA MODI
WHERE IS SINDH....A PETITION TO HON. PRIME MINISTER NARENDRA MODI
 
Jam dinding belajar
Jam dinding belajarJam dinding belajar
Jam dinding belajar
 
Article from the british medical journal summary of nice ssi guidelines
Article from the british medical journal summary of nice ssi guidelinesArticle from the british medical journal summary of nice ssi guidelines
Article from the british medical journal summary of nice ssi guidelines
 
Naturals herbal Avon - Секреты родной природы для Вашей красоты
Naturals herbal Avon - Секреты родной природы для Вашей красотыNaturals herbal Avon - Секреты родной природы для Вашей красоты
Naturals herbal Avon - Секреты родной природы для Вашей красоты
 
Anew - заряд энергии 25+
Anew - заряд энергии 25+Anew - заряд энергии 25+
Anew - заряд энергии 25+
 
Sql queries with answers
Sql queries with answersSql queries with answers
Sql queries with answers
 

Similar to A

Sub Queries in oracle
Sub Queries in oracleSub Queries in oracle
Sub Queries in oracle
pyingkodi maran
 
Extra assign
Extra assignExtra assign
Extra assign
dipeshtare
 
Sql queries
Sql queriesSql queries
Sql queries
narendrababuc
 
CBO Basics: Cardinality
CBO Basics: CardinalityCBO Basics: Cardinality
CBO Basics: Cardinality
Sidney Chen
 
M|18 Understanding the Query Optimizer
M|18 Understanding the Query OptimizerM|18 Understanding the Query Optimizer
M|18 Understanding the Query Optimizer
MariaDB plc
 
RA-examples.ppt
RA-examples.pptRA-examples.ppt
RA-examples.ppt
RishabhSingh265589
 
New Query Optimizer features in MariaDB 10.3
New Query Optimizer features in MariaDB 10.3New Query Optimizer features in MariaDB 10.3
New Query Optimizer features in MariaDB 10.3
Sergey Petrunya
 

Similar to A (7)

Sub Queries in oracle
Sub Queries in oracleSub Queries in oracle
Sub Queries in oracle
 
Extra assign
Extra assignExtra assign
Extra assign
 
Sql queries
Sql queriesSql queries
Sql queries
 
CBO Basics: Cardinality
CBO Basics: CardinalityCBO Basics: Cardinality
CBO Basics: Cardinality
 
M|18 Understanding the Query Optimizer
M|18 Understanding the Query OptimizerM|18 Understanding the Query Optimizer
M|18 Understanding the Query Optimizer
 
RA-examples.ppt
RA-examples.pptRA-examples.ppt
RA-examples.ppt
 
New Query Optimizer features in MariaDB 10.3
New Query Optimizer features in MariaDB 10.3New Query Optimizer features in MariaDB 10.3
New Query Optimizer features in MariaDB 10.3
 

Recently uploaded

Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
ssuser13ffe4
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 

Recently uploaded (20)

Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 

A

  • 1. 1) What are the names of customers who have sent packages (shipments) to Sioux City? SQL> Selectcust_id,cust_name from CUSTOMERsss where cust_id in (select cust_id from shipmentsss where destination = 'Sioux'); Ans:-no rows selected 2)To what destinations have companies with revenue less than $1 million sent packages? SQL>select distinct(destination) from shipmentsss where cust_id in (select cust_id from customersss where annual_revenue< 10000000); DESTINATION --------------London Sioux City Baltimore Panama City Rome San Francisco St.Louis Los Angeles Manhattan Paris 10 rows selected. 3)What are the names and populations of cities that have received shipments weighing over 100 pounds? SQL>select city_name,population from citysss where city_name in (select destination from shipmentsss where weight > 100); CITY_NAME POPULATION ------------------------------ ---------London Manhattan 100000000 10000000
  • 2. Rome San Francisco Sioux City 200000000 20000000 5000000000 4)> select cust_id,cust_name from CUSTOMERsss where annual_revenue> 5000000 and cust_id in ( select cust_id from shipmentsss where weight <1); Ans:-no rows selected 5)selectcust_id,cust_name from customersss where annual_revenue> 5000000 and cust_id in (select cust_id from shipmentsss where weight < 1 or destination = 'San Francisco'); Ans:-no rows selected 6)select truck_#,driver_name from trucksss where truck_# in (select truck_# from shipmentsss where cust_id in (select cust_id from customersss where annual_revenue>2000000) and destination in (select city_name from citysss where population > 1000000)); TRUCK_# DRIVER_NAME --------- -----------100 Jensen 102 Hrithik 101 Sasi 103 Jake Stinson
  • 3. 7)select distinct(destination) from shipmentsss where cust_id in ( select cust_id from customersss where annual_revenue>1500000); DESTINATION --------------London Baltimore Panama City San Francisco Rome St.Louis Los Angeles Manhattan Paris 9 rows selected. 8)select truck_#,driver_name from trucksss where truck_# in (select truck_# from shipmentsss where weight > 100); TRUCK_# DRIVER_NAME --------- -----------100 Jensen 102 Hrithik
  • 4. 103 Jake Stinson 9)selectcust_name,annual_revenue from customersss where cust_id in (select cust_id from shipmentsss where weight > 100); CUST_NAME ANNUAL_REVENUE -------------------- -------------Revathi 1000000 Richa 1800000 Rishi 1000000 Kalyan 4800000 10)selectcust_name,annual_revenue from customersss where cust_id in (select cust_id from shipmentsss where truck_# in (select truck_# from trucksss where driver_name = 'Jensen')); CUST_NAME ANNUAL_REVENUE -------------------- -------------Revathi 1000000 Kalyan 4800000 Rijesh 4000000 11)selectcust_id,cust_name from customersss where ( select count(distinct(truck_#)) from shipmentsss where shipmentsss.cust_id = customersss.cust_id) >= (select count(*) from truck);
  • 5. CUST_ID CUST_NAME --------- -------------------100 Revathi 103 Rijesh 104 Kalyan 12)selectcity_name from citysss where (select count (distinct ( cust_id)) from shipmentsss where destination = citysss.city_name) >= (select count (*) from customersss); Ans:no rows selected 13)selectdriver_name from trucksss where truck_# in (select truck_# from trucksss where (select count(distinct(destination)) from shipmentsss where shipmentsss.truck_# = trucksss.truck_#) >= (select count (*) from citysss)); Ans:- no rows selected 14)selectcust_id,cust_name from customersss where cust_type = 'manufacturer' or cust_id in (select cust_id from shipmentsss where destination = 'St. Louis'); CUST_ID CUST_NAME -------- -------------100 Revathi
  • 6. 15)selectcity_name from citysss where population > 1000000 and city_name in (select destination from shipmentsss where weight = 100 and cust_id = 311); Ans:- no rows selected 16)> select truck_# from trucksss where driver_name = 'Jake Stinson' and truck_# in (select truck_# from shipmentsss where destination <> 'Denver'); TRUCK_# ---------103 17)selectcust_id,cust_name from customersss where annual_revenue> 10000000 and cust_id in (select cust_id from shipmentsss where destination in (selectcity_name from city where population < 10000) and weight < 1); Ans:- no rows selected 18a)SQL> create view revenue_1 as select cust_id,cust_name from customerss where annual_revenue< 1000000; b)create view revenue_2 as select cust_id,cust_name from customersss where annual_revenue> 1000000 and annual_revenue< 5000000; c)> create view revenue_3 as select cust_id, cust_name from customersss where annual_revenue> 5000000;
  • 7. 19a)select * from revenue_3 where cust_id in (select cust_id from shipmentsss where destination = 'Los Angeles');