SlideShare a Scribd company logo
1 of 9
SQL Commands executed in
SQL Plus
Sunil Kumar Gunasekaran
Creating table PERSONS1013 with the following Attribute names

Altering the Column name of the table P_ID to include NOT NULL and PRIMARY
KEY status

Adding another column SALARY with data type as Number;

Page 1
After all the modifications done to the table

Sample of records into the table using INSERT command
Inse

Page 2
The table with the values loaded is shown below

Page 3
Getting the details of the record having the highest salary

Getting the name of the person with the highest salary

Getting the name of the person with minimum salary

Page 4
Getting the names of persons with salary greater than the average salary
The nested statements are used when there is one to one relationship between
person and salary.

Need to work out on Inner Join Outer Join and Natural Join and other functions and update here to be
done or revised before any interview.

Dropping the whole table using DROP DDL command

Deleting a particular record

Using Group by with a function to group by the entities based on the function;
Note that only Sum and average require group by since

Page 5
This is the Orders table for the above GROUP BY function execution.
The requirement is that there need to be a customer and many orders placed by him and hence many
orderprices. If we want info of the max min avg sum of the orderprices placed by each customer, then
use group by along with the functions.
Usage of Having
Having and group by are used in one t omany relationship between customer and orderprice
This is similar to where only that the aggregate functions can be used in having and aggregate functions
cannot be used in where.

Page 6
Note that the having can hold expressions involving aggregate functions
INNER JOIN
There are two tables. Table 1 having customer firstr name last name address and city and P_ID;
The second table has details of order i.eorderid, order number and P_ID.
We need customer first name and customer last name and the order number of customers who made
orders present in the Persons table. Hence we use inner join for this.

JOINS
Consider the following Persons table and Orders table. They have in common PID
Customer Table has PIDs 1 2 and 3
Orders Table has PIDs 3 3 1 1 and 15
We are going to make a join based on this common key.
When the join is made, a appended table containing all the column headings appear.
PID LN FN Add City O_IdONumber PID
First the common elements are filled in the above table. This forms inner join
If the remnants of first table is added to the common records, then it is LEFT JOIN
If remnants of right table is added to the common records ,then it is RIGHT JOIN
Page 7
If remnants of left and right are added to the common records, then it is FULL JOIN.
In all cases remember the appended table in mind and work out accordingly.

Page 8

More Related Content

Viewers also liked

6. electronic payment systems
6. electronic payment systems6. electronic payment systems
6. electronic payment systemsPratap Tirkey
 
Electronic payment System
Electronic payment SystemElectronic payment System
Electronic payment SystemMohammad Waqas
 
Chp8 electronic payment system
Chp8 electronic payment systemChp8 electronic payment system
Chp8 electronic payment systemEngr Razaque
 
Electronic payment system
Electronic payment systemElectronic payment system
Electronic payment system60ml
 
Electronic Payment Systems (EPS)
Electronic Payment Systems (EPS)Electronic Payment Systems (EPS)
Electronic Payment Systems (EPS)Sahan Walpitagamage
 
Electronic Payment System
Electronic Payment SystemElectronic Payment System
Electronic Payment SystemRitesh Goyal
 
The electronic payment systems
The electronic payment systemsThe electronic payment systems
The electronic payment systemsVishal Singh
 
electronic_payment_system_in_korea_eng
electronic_payment_system_in_korea_engelectronic_payment_system_in_korea_eng
electronic_payment_system_in_korea_engFrank Mercado
 

Viewers also liked (9)

6. electronic payment systems
6. electronic payment systems6. electronic payment systems
6. electronic payment systems
 
Chp7 intranet
Chp7 intranetChp7 intranet
Chp7 intranet
 
Electronic payment System
Electronic payment SystemElectronic payment System
Electronic payment System
 
Chp8 electronic payment system
Chp8 electronic payment systemChp8 electronic payment system
Chp8 electronic payment system
 
Electronic payment system
Electronic payment systemElectronic payment system
Electronic payment system
 
Electronic Payment Systems (EPS)
Electronic Payment Systems (EPS)Electronic Payment Systems (EPS)
Electronic Payment Systems (EPS)
 
Electronic Payment System
Electronic Payment SystemElectronic Payment System
Electronic Payment System
 
The electronic payment systems
The electronic payment systemsThe electronic payment systems
The electronic payment systems
 
electronic_payment_system_in_korea_eng
electronic_payment_system_in_korea_engelectronic_payment_system_in_korea_eng
electronic_payment_system_in_korea_eng
 

Similar to Sql commands worked out in sql plus with screen shots

Day-2 SQL Theory_V1.pptx
Day-2 SQL Theory_V1.pptxDay-2 SQL Theory_V1.pptx
Day-2 SQL Theory_V1.pptxuzmasulthana3
 
Sap abap-data structures and internal tables
Sap abap-data structures and internal tablesSap abap-data structures and internal tables
Sap abap-data structures and internal tablesMustafa Nadim
 
HALL OF FAME INDUCTIONS
HALL OF FAME INDUCTIONSHALL OF FAME INDUCTIONS
HALL OF FAME INDUCTIONSTalia Strnad
 
What is Database NormalizationExplain the guidelines for ensuring t.pdf
What is Database NormalizationExplain the guidelines for ensuring t.pdfWhat is Database NormalizationExplain the guidelines for ensuring t.pdf
What is Database NormalizationExplain the guidelines for ensuring t.pdfarjunstores123
 

Similar to Sql commands worked out in sql plus with screen shots (7)

Day-2 SQL Theory_V1.pptx
Day-2 SQL Theory_V1.pptxDay-2 SQL Theory_V1.pptx
Day-2 SQL Theory_V1.pptx
 
Sq lite module7
Sq lite module7Sq lite module7
Sq lite module7
 
Sap abap-data structures and internal tables
Sap abap-data structures and internal tablesSap abap-data structures and internal tables
Sap abap-data structures and internal tables
 
HALL OF FAME INDUCTIONS
HALL OF FAME INDUCTIONSHALL OF FAME INDUCTIONS
HALL OF FAME INDUCTIONS
 
What is Database NormalizationExplain the guidelines for ensuring t.pdf
What is Database NormalizationExplain the guidelines for ensuring t.pdfWhat is Database NormalizationExplain the guidelines for ensuring t.pdf
What is Database NormalizationExplain the guidelines for ensuring t.pdf
 
Chapter9 more on database and sql
Chapter9 more on database and sqlChapter9 more on database and sql
Chapter9 more on database and sql
 
FD.pdf
FD.pdfFD.pdf
FD.pdf
 

More from Sunil Kumar Gunasekaran

Sample Technical Requirement Document (TRD)
Sample Technical Requirement Document (TRD)Sample Technical Requirement Document (TRD)
Sample Technical Requirement Document (TRD)Sunil Kumar Gunasekaran
 
Business Requirements Document for Acounts Payable System
Business Requirements Document for Acounts Payable SystemBusiness Requirements Document for Acounts Payable System
Business Requirements Document for Acounts Payable SystemSunil Kumar Gunasekaran
 
Test Life Cycle - Presentation - Important concepts covered
Test Life Cycle - Presentation - Important concepts coveredTest Life Cycle - Presentation - Important concepts covered
Test Life Cycle - Presentation - Important concepts coveredSunil Kumar Gunasekaran
 
PERL for QA - Important Commands and applications
PERL for QA - Important Commands and applicationsPERL for QA - Important Commands and applications
PERL for QA - Important Commands and applicationsSunil Kumar Gunasekaran
 
JAVA Notes - All major concepts covered with examples
JAVA Notes - All major concepts covered with examplesJAVA Notes - All major concepts covered with examples
JAVA Notes - All major concepts covered with examplesSunil Kumar Gunasekaran
 
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...Sunil Kumar Gunasekaran
 
Fitnesse user acceptance test - Presentation
Fitnesse   user acceptance test - PresentationFitnesse   user acceptance test - Presentation
Fitnesse user acceptance test - PresentationSunil Kumar Gunasekaran
 

More from Sunil Kumar Gunasekaran (20)

CQL - Cassandra commands Notes
CQL - Cassandra commands NotesCQL - Cassandra commands Notes
CQL - Cassandra commands Notes
 
Java J2EE Complete Syllabus Checklist
Java J2EE Complete Syllabus ChecklistJava J2EE Complete Syllabus Checklist
Java J2EE Complete Syllabus Checklist
 
Amazon search test case document
Amazon search test case documentAmazon search test case document
Amazon search test case document
 
Actual test case document
Actual test case documentActual test case document
Actual test case document
 
Sample Technical Requirement Document (TRD)
Sample Technical Requirement Document (TRD)Sample Technical Requirement Document (TRD)
Sample Technical Requirement Document (TRD)
 
Sql reference from w3 schools
Sql reference from w3 schools Sql reference from w3 schools
Sql reference from w3 schools
 
Wells fargo banking system ER Diagram
Wells fargo banking system ER DiagramWells fargo banking system ER Diagram
Wells fargo banking system ER Diagram
 
Business Requirements Document for Acounts Payable System
Business Requirements Document for Acounts Payable SystemBusiness Requirements Document for Acounts Payable System
Business Requirements Document for Acounts Payable System
 
Automation Testing Syllabus - Checklist
Automation Testing Syllabus - ChecklistAutomation Testing Syllabus - Checklist
Automation Testing Syllabus - Checklist
 
Unix short
Unix shortUnix short
Unix short
 
Unix made easy
Unix made easyUnix made easy
Unix made easy
 
Test process - Important Concepts
Test process - Important ConceptsTest process - Important Concepts
Test process - Important Concepts
 
Testing http methods using Telnet
Testing http methods using TelnetTesting http methods using Telnet
Testing http methods using Telnet
 
Test Life Cycle - Presentation - Important concepts covered
Test Life Cycle - Presentation - Important concepts coveredTest Life Cycle - Presentation - Important concepts covered
Test Life Cycle - Presentation - Important concepts covered
 
Scrum writeup - Agile
Scrum writeup - Agile Scrum writeup - Agile
Scrum writeup - Agile
 
Scrum, V Model and RUP Models Overview
Scrum, V Model and RUP Models OverviewScrum, V Model and RUP Models Overview
Scrum, V Model and RUP Models Overview
 
PERL for QA - Important Commands and applications
PERL for QA - Important Commands and applicationsPERL for QA - Important Commands and applications
PERL for QA - Important Commands and applications
 
JAVA Notes - All major concepts covered with examples
JAVA Notes - All major concepts covered with examplesJAVA Notes - All major concepts covered with examples
JAVA Notes - All major concepts covered with examples
 
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
 
Fitnesse user acceptance test - Presentation
Fitnesse   user acceptance test - PresentationFitnesse   user acceptance test - Presentation
Fitnesse user acceptance test - Presentation
 

Recently uploaded

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 

Recently uploaded (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 

Sql commands worked out in sql plus with screen shots

  • 1. SQL Commands executed in SQL Plus Sunil Kumar Gunasekaran
  • 2. Creating table PERSONS1013 with the following Attribute names Altering the Column name of the table P_ID to include NOT NULL and PRIMARY KEY status Adding another column SALARY with data type as Number; Page 1
  • 3. After all the modifications done to the table Sample of records into the table using INSERT command Inse Page 2
  • 4. The table with the values loaded is shown below Page 3
  • 5. Getting the details of the record having the highest salary Getting the name of the person with the highest salary Getting the name of the person with minimum salary Page 4
  • 6. Getting the names of persons with salary greater than the average salary The nested statements are used when there is one to one relationship between person and salary. Need to work out on Inner Join Outer Join and Natural Join and other functions and update here to be done or revised before any interview. Dropping the whole table using DROP DDL command Deleting a particular record Using Group by with a function to group by the entities based on the function; Note that only Sum and average require group by since Page 5
  • 7. This is the Orders table for the above GROUP BY function execution. The requirement is that there need to be a customer and many orders placed by him and hence many orderprices. If we want info of the max min avg sum of the orderprices placed by each customer, then use group by along with the functions. Usage of Having Having and group by are used in one t omany relationship between customer and orderprice This is similar to where only that the aggregate functions can be used in having and aggregate functions cannot be used in where. Page 6
  • 8. Note that the having can hold expressions involving aggregate functions INNER JOIN There are two tables. Table 1 having customer firstr name last name address and city and P_ID; The second table has details of order i.eorderid, order number and P_ID. We need customer first name and customer last name and the order number of customers who made orders present in the Persons table. Hence we use inner join for this. JOINS Consider the following Persons table and Orders table. They have in common PID Customer Table has PIDs 1 2 and 3 Orders Table has PIDs 3 3 1 1 and 15 We are going to make a join based on this common key. When the join is made, a appended table containing all the column headings appear. PID LN FN Add City O_IdONumber PID First the common elements are filled in the above table. This forms inner join If the remnants of first table is added to the common records, then it is LEFT JOIN If remnants of right table is added to the common records ,then it is RIGHT JOIN Page 7
  • 9. If remnants of left and right are added to the common records, then it is FULL JOIN. In all cases remember the appended table in mind and work out accordingly. Page 8