SlideShare a Scribd company logo
1 of 9
---------------------------------------------------------

15 SQL QUERIES:

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



1)Names of Customer who have ordered items from dept having DID='D00001'



select CNAME from customer1 CID IN(select CID from cust_dept1 where DID='D00001');



O/P:



CNAME

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

Bharti

Ena



2 rows selected.



2)Find the type of books in which Tina is interested



select BOOK_NAME from books1 where DID IN (Select DID from cust_dept1 where CID IN(Select CID
from customer1 where CNAME='Tina'));



O/P:



BOOK_NAME
--------------------

biography

fiction



2 rows selected.



3)Type of Clothing selected by Nehal



select CLOTH_NAME from clothing1 where DID IN (Select DID from cust_dept1 where CID IN(Select CID
from customer1 where CNAME='Nehal'));



O/P:



CLOTH_NAME

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

Formals

Traditional

Jeans



1 row selected.



4)Customers who dont stay in Mumbai and Delhi



select CNAME from customer where CADDRESS NOT IN('Mumbai','Delhi');



O/P:
CNAME

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

Ena

Nehal



2 rows selected.



5)Customers who are interested in TV whose inches are in the range of 30



select CNAME from customer where CID IN (Select CID from cust_dept where DID IN(Select DID from
electronics where ENAME='TV' and EID IN(Select EID from TV where inches like('3%'))));



O/P:



CNAME

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

Bharti

Ena



2 rows selected.



6)Mobile having bluetooth connectivity



select * from mobile where connectivity like ('B%');
O/P:



CONNECTIVITY              EID

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

Bluetooth             E00001

Bluetooth             E00001



2 rows selected.



7)Customers whose name end with 'na'



select CID,CNAME from customer where CNAME like ('%na');



O/P:



CID       CNAME

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

C00002       Ena

C00004       Krina

C00005       Tina



3 rows selected.



8)Items belonging to Electronics department
select ENAME from electronics where Exists(Select DID from cust_dept where
electronics.DID=cust_dept.DID ) ;



O/P:



ENAME

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

MOBILE

cameras

TV



3 rows selected.



9)Details of Items pressent in mobile section of Electronics department



Select * from electronics e ,mobile m where e.EID=m.EID;



O/P:



EID       ENAME                     ECOST DID           CONNECTIVITY               EID

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

E00001       MOBILE                    10000 D00001           Bluetooth                 E00001

E00001       MOBILE                    10000 D00001           Infrared             E00001

E00001       MOBILE                    10000 D00001           Bluetooth                 E00001



3 rows selected.
10)Ascending order



select * from customer order by CNAME;



O/P:



CID       CNAME                 CADDRESS

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

C00001       Bharti              Mumbai

C00002       Ena                Pune

C00004       Krina              Delhi

C00003       Nehal               Banglore

C00005       Tina               Mumbai



5 rows selected.



11)Descending Order



select * from customer order by CNAME desc;



O/P:



CID       CNAME                 CADDRESS

---------- -------------------- ------------------------------
C00005       Tina               Mumbai

C00003       Nehal               Banglore

C00004       Krina              Delhi

C00002       Ena                Pune

C00001       Bharti              Mumbai



5 rows selected.



12)Details about which customers interested in which department (use of using clause)



select CID,c.CNAME,c.CADDRESS,d.DID from customer c join cust_dept d using (CID);



O/P:

CID       CNAME                 CADDRESS                        DID

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

C00001       Bharti              Mumbai                        D00001

C00002       Ena                Pune                       D00001

C00003       Nehal               Banglore                     D00002

C00004       Krina              Delhi                      D00002

C00005       Tina               Mumbai                        D00003



5 rows selected.




13)Customers interested in mobiles having connectivity='bluetooth'
select * from customer where CID in (Select CID from cust_dept where DID in (Select DID from
electronics where EID in(Select EID from mobile where connectivity='Bluetooth')));




O/P:



CID       CNAME                 CADDRESS

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

C00001       Bharti              Mumbai

C00002       Ena                Pune



2 rows selected.




14)Customers interested in biography section of books department



select * from customer where CID in (Select CID from cust_dept where DID in (Select DID from books
where BOOK_ID in (Select BOOK_ID from biography where TYPE='Freedom Fighter')));



O/P:



CID       CNAME                 CADDRESS

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

C00005       Tina               Mumbai
1 row selected.




15)Electronic items having cost > 10000



select * from electronics where ECOST > 10000



O/P:



EID       ENAME                     ECOST DID

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

E00002       cameras                   20000 D00001

E00003       TV                    15000 D00001



2 rows selected.

More Related Content

Viewers also liked

Call Sheet Field
Call Sheet FieldCall Sheet Field
Call Sheet Fieldsamjewiss
 
Photo Essay
Photo EssayPhoto Essay
Photo Essayderek20
 
Focus group-questionnaire
Focus group-questionnaireFocus group-questionnaire
Focus group-questionnaireJwbread
 
cuenta
cuentacuenta
cuentaj0ofer
 
Questionnaire
QuestionnaireQuestionnaire
QuestionnaireJwbread
 
Music magazine questionnaire
Music magazine questionnaireMusic magazine questionnaire
Music magazine questionnaireizzy_hennessy
 
Contents page editing
Contents page editingContents page editing
Contents page editingizzy_hennessy
 
The Scandinavian Company Skin Arctica
The Scandinavian Company Skin ArcticaThe Scandinavian Company Skin Arctica
The Scandinavian Company Skin Arcticacarinawood888
 
Facebook: Entwicklung von ausgesuchten Schweizer Markenfanseiten (Update: Jun...
Facebook: Entwicklung von ausgesuchten Schweizer Markenfanseiten (Update: Jun...Facebook: Entwicklung von ausgesuchten Schweizer Markenfanseiten (Update: Jun...
Facebook: Entwicklung von ausgesuchten Schweizer Markenfanseiten (Update: Jun...Social Media Schweiz
 
Analysis of lady gaga just dance2
Analysis of lady gaga just dance2Analysis of lady gaga just dance2
Analysis of lady gaga just dance2demioshea
 
Proyecto de conducta
Proyecto de conductaProyecto de conducta
Proyecto de conductachuyzai
 

Viewers also liked (20)

Call Sheet Field
Call Sheet FieldCall Sheet Field
Call Sheet Field
 
Photo Essay
Photo EssayPhoto Essay
Photo Essay
 
Initial Ideas
Initial IdeasInitial Ideas
Initial Ideas
 
Presentation1
Presentation1Presentation1
Presentation1
 
Focus group-questionnaire
Focus group-questionnaireFocus group-questionnaire
Focus group-questionnaire
 
Social groups
Social groupsSocial groups
Social groups
 
Evaluation
EvaluationEvaluation
Evaluation
 
cuenta
cuentacuenta
cuenta
 
Questionnaire
QuestionnaireQuestionnaire
Questionnaire
 
Social groups
Social groupsSocial groups
Social groups
 
Estopa
EstopaEstopa
Estopa
 
Music magazine questionnaire
Music magazine questionnaireMusic magazine questionnaire
Music magazine questionnaire
 
Contents page editing
Contents page editingContents page editing
Contents page editing
 
The Scandinavian Company Skin Arctica
The Scandinavian Company Skin ArcticaThe Scandinavian Company Skin Arctica
The Scandinavian Company Skin Arctica
 
Facebook: Entwicklung von ausgesuchten Schweizer Markenfanseiten (Update: Jun...
Facebook: Entwicklung von ausgesuchten Schweizer Markenfanseiten (Update: Jun...Facebook: Entwicklung von ausgesuchten Schweizer Markenfanseiten (Update: Jun...
Facebook: Entwicklung von ausgesuchten Schweizer Markenfanseiten (Update: Jun...
 
Lyric breakdown
Lyric breakdownLyric breakdown
Lyric breakdown
 
Analysis of lady gaga just dance2
Analysis of lady gaga just dance2Analysis of lady gaga just dance2
Analysis of lady gaga just dance2
 
Proyecto de conducta
Proyecto de conductaProyecto de conducta
Proyecto de conducta
 
25 de abril ii
25 de abril ii25 de abril ii
25 de abril ii
 
Corridor recording
Corridor recordingCorridor recording
Corridor recording
 

Similar to Queries2

Bala ji microtechnologies cameralink line scan camera korea
Bala ji microtechnologies cameralink line scan camera koreaBala ji microtechnologies cameralink line scan camera korea
Bala ji microtechnologies cameralink line scan camera koreabalajibmt02
 
Bmt 2098 c-a-line_scan_camera_user_manual
Bmt 2098 c-a-line_scan_camera_user_manualBmt 2098 c-a-line_scan_camera_user_manual
Bmt 2098 c-a-line_scan_camera_user_manualBalajimicrotechnologies
 
Bala ji microtechnologies analog line scan camera korea
Bala ji microtechnologies analog line scan camera koreaBala ji microtechnologies analog line scan camera korea
Bala ji microtechnologies analog line scan camera koreabalajibmt02
 
DetailsiBeacon_endocsSetupBeaconInIOS.pdf
DetailsiBeacon_endocsSetupBeaconInIOS.pdfDetailsiBeacon_endocsSetupBeaconInIOS.pdf
DetailsiBeacon_endocsSetupBeaconInIOS.pdfSomnathKhamaru1
 
Pmcs user exits
Pmcs user exitsPmcs user exits
Pmcs user exitsJohn Peter
 
Ks 858 e intelligent network alarm systems panel user's manual
Ks 858 e intelligent network alarm systems panel user's manualKs 858 e intelligent network alarm systems panel user's manual
Ks 858 e intelligent network alarm systems panel user's manualVedard Security Alarm System Store
 
SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所Hiroshi Sekiguchi
 
Auto dial-er Home security
Auto dial-er Home securityAuto dial-er Home security
Auto dial-er Home securityvaibhav jindal
 
zte umts-cs-call-drop-analysis-guide-zte
zte umts-cs-call-drop-analysis-guide-ztezte umts-cs-call-drop-analysis-guide-zte
zte umts-cs-call-drop-analysis-guide-zte3ggprs
 
Electronics for-you-projects-and-ideas-2000
Electronics for-you-projects-and-ideas-2000Electronics for-you-projects-and-ideas-2000
Electronics for-you-projects-and-ideas-2000nonshahid
 
Electronics for you projects and ideas 2000 (malestrom)
Electronics for you projects and ideas 2000 (malestrom)Electronics for you projects and ideas 2000 (malestrom)
Electronics for you projects and ideas 2000 (malestrom)Rohit Chintu
 
2000 circuit project
2000 circuit project2000 circuit project
2000 circuit projectQuangTrnMinh3
 
Electronics for you (jan dec 2000)
Electronics for you (jan dec 2000)Electronics for you (jan dec 2000)
Electronics for you (jan dec 2000)vikas_kumar10Aug
 
Microsoft Word Mobile Multi Media Applications
Microsoft Word   Mobile Multi Media ApplicationsMicrosoft Word   Mobile Multi Media Applications
Microsoft Word Mobile Multi Media Applicationskkkseld
 

Similar to Queries2 (20)

Sql queries
Sql queriesSql queries
Sql queries
 
Bala ji microtechnologies cameralink line scan camera korea
Bala ji microtechnologies cameralink line scan camera koreaBala ji microtechnologies cameralink line scan camera korea
Bala ji microtechnologies cameralink line scan camera korea
 
Bmt 2098 c-a-line_scan_camera_user_manual
Bmt 2098 c-a-line_scan_camera_user_manualBmt 2098 c-a-line_scan_camera_user_manual
Bmt 2098 c-a-line_scan_camera_user_manual
 
Bala ji microtechnologies analog line scan camera korea
Bala ji microtechnologies analog line scan camera koreaBala ji microtechnologies analog line scan camera korea
Bala ji microtechnologies analog line scan camera korea
 
DetailsiBeacon_endocsSetupBeaconInIOS.pdf
DetailsiBeacon_endocsSetupBeaconInIOS.pdfDetailsiBeacon_endocsSetupBeaconInIOS.pdf
DetailsiBeacon_endocsSetupBeaconInIOS.pdf
 
Pmcs user exits
Pmcs user exitsPmcs user exits
Pmcs user exits
 
Ks 858 e intelligent network alarm systems panel user's manual
Ks 858 e intelligent network alarm systems panel user's manualKs 858 e intelligent network alarm systems panel user's manual
Ks 858 e intelligent network alarm systems panel user's manual
 
SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所SQLチューニング総合診療Oracle CloudWorld出張所
SQLチューニング総合診療Oracle CloudWorld出張所
 
Auto dial-er Home security
Auto dial-er Home securityAuto dial-er Home security
Auto dial-er Home security
 
zte umts-cs-call-drop-analysis-guide-zte
zte umts-cs-call-drop-analysis-guide-ztezte umts-cs-call-drop-analysis-guide-zte
zte umts-cs-call-drop-analysis-guide-zte
 
Electronics for-you-projects-and-ideas-2000
Electronics for-you-projects-and-ideas-2000Electronics for-you-projects-and-ideas-2000
Electronics for-you-projects-and-ideas-2000
 
Electronics for you projects and ideas 2000 (malestrom)
Electronics for you projects and ideas 2000 (malestrom)Electronics for you projects and ideas 2000 (malestrom)
Electronics for you projects and ideas 2000 (malestrom)
 
Cn51 configuração
Cn51 configuraçãoCn51 configuração
Cn51 configuração
 
Mc18 Zebra
Mc18 ZebraMc18 Zebra
Mc18 Zebra
 
BTS Key Mgt
BTS Key MgtBTS Key Mgt
BTS Key Mgt
 
Resume Local canada
Resume Local canadaResume Local canada
Resume Local canada
 
2000 circuit project
2000 circuit project2000 circuit project
2000 circuit project
 
Projetos eletrônicos
Projetos eletrônicosProjetos eletrônicos
Projetos eletrônicos
 
Electronics for you (jan dec 2000)
Electronics for you (jan dec 2000)Electronics for you (jan dec 2000)
Electronics for you (jan dec 2000)
 
Microsoft Word Mobile Multi Media Applications
Microsoft Word   Mobile Multi Media ApplicationsMicrosoft Word   Mobile Multi Media Applications
Microsoft Word Mobile Multi Media Applications
 

Recently uploaded

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 

Recently uploaded (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

Queries2

  • 1. --------------------------------------------------------- 15 SQL QUERIES: --------------------------------------------------------- 1)Names of Customer who have ordered items from dept having DID='D00001' select CNAME from customer1 CID IN(select CID from cust_dept1 where DID='D00001'); O/P: CNAME -------------------- Bharti Ena 2 rows selected. 2)Find the type of books in which Tina is interested select BOOK_NAME from books1 where DID IN (Select DID from cust_dept1 where CID IN(Select CID from customer1 where CNAME='Tina')); O/P: BOOK_NAME
  • 2. -------------------- biography fiction 2 rows selected. 3)Type of Clothing selected by Nehal select CLOTH_NAME from clothing1 where DID IN (Select DID from cust_dept1 where CID IN(Select CID from customer1 where CNAME='Nehal')); O/P: CLOTH_NAME -------------------- Formals Traditional Jeans 1 row selected. 4)Customers who dont stay in Mumbai and Delhi select CNAME from customer where CADDRESS NOT IN('Mumbai','Delhi'); O/P:
  • 3. CNAME -------------------- Ena Nehal 2 rows selected. 5)Customers who are interested in TV whose inches are in the range of 30 select CNAME from customer where CID IN (Select CID from cust_dept where DID IN(Select DID from electronics where ENAME='TV' and EID IN(Select EID from TV where inches like('3%')))); O/P: CNAME -------------------- Bharti Ena 2 rows selected. 6)Mobile having bluetooth connectivity select * from mobile where connectivity like ('B%');
  • 4. O/P: CONNECTIVITY EID -------------------- ---------- Bluetooth E00001 Bluetooth E00001 2 rows selected. 7)Customers whose name end with 'na' select CID,CNAME from customer where CNAME like ('%na'); O/P: CID CNAME ---------- -------------------- C00002 Ena C00004 Krina C00005 Tina 3 rows selected. 8)Items belonging to Electronics department
  • 5. select ENAME from electronics where Exists(Select DID from cust_dept where electronics.DID=cust_dept.DID ) ; O/P: ENAME -------------------- MOBILE cameras TV 3 rows selected. 9)Details of Items pressent in mobile section of Electronics department Select * from electronics e ,mobile m where e.EID=m.EID; O/P: EID ENAME ECOST DID CONNECTIVITY EID ---------- -------------------- ---------- ---------- -------------------- ---------- E00001 MOBILE 10000 D00001 Bluetooth E00001 E00001 MOBILE 10000 D00001 Infrared E00001 E00001 MOBILE 10000 D00001 Bluetooth E00001 3 rows selected.
  • 6. 10)Ascending order select * from customer order by CNAME; O/P: CID CNAME CADDRESS ---------- -------------------- ------------------------------ C00001 Bharti Mumbai C00002 Ena Pune C00004 Krina Delhi C00003 Nehal Banglore C00005 Tina Mumbai 5 rows selected. 11)Descending Order select * from customer order by CNAME desc; O/P: CID CNAME CADDRESS ---------- -------------------- ------------------------------
  • 7. C00005 Tina Mumbai C00003 Nehal Banglore C00004 Krina Delhi C00002 Ena Pune C00001 Bharti Mumbai 5 rows selected. 12)Details about which customers interested in which department (use of using clause) select CID,c.CNAME,c.CADDRESS,d.DID from customer c join cust_dept d using (CID); O/P: CID CNAME CADDRESS DID ---------- -------------------- ------------------------------ ---------- C00001 Bharti Mumbai D00001 C00002 Ena Pune D00001 C00003 Nehal Banglore D00002 C00004 Krina Delhi D00002 C00005 Tina Mumbai D00003 5 rows selected. 13)Customers interested in mobiles having connectivity='bluetooth'
  • 8. select * from customer where CID in (Select CID from cust_dept where DID in (Select DID from electronics where EID in(Select EID from mobile where connectivity='Bluetooth'))); O/P: CID CNAME CADDRESS ---------- -------------------- ------------------------------ C00001 Bharti Mumbai C00002 Ena Pune 2 rows selected. 14)Customers interested in biography section of books department select * from customer where CID in (Select CID from cust_dept where DID in (Select DID from books where BOOK_ID in (Select BOOK_ID from biography where TYPE='Freedom Fighter'))); O/P: CID CNAME CADDRESS ---------- -------------------- ------------------------------ C00005 Tina Mumbai
  • 9. 1 row selected. 15)Electronic items having cost > 10000 select * from electronics where ECOST > 10000 O/P: EID ENAME ECOST DID ---------- -------------------- ---------- ---------- E00002 cameras 20000 D00001 E00003 TV 15000 D00001 2 rows selected.