SlideShare una empresa de Scribd logo
1 de 12
Descargar para leer sin conexión
Dynamic Websites
PHP with Oracle DB   By Belal Arfa
Section 4
In this section will discuss
  1- SQL Practical Examples
Examples
Schema:
Beers(name, made_by)
Bars(name, addr, license)
Drinkers(name, addr, phone)
Likes(drinker, beer)
Sells(bar, beer, price)
Frequents(drinker, bar)
Question:
What beers are made by John Smith?
Answer: SELECT name FROM Beers WHERE made_by= 'John Smith';

Note single quotes for strings.
Examples
- The database is formed from 2 tables, CAR and DRIVER.
- Each car may be owned by a DRIVER.
- A DRIVER may own multiple CARs.


         Driver                               Car

Driver                         Car
                                        REGNO       Make     Color   Price   Owner

   NAME        DOB                      F611AAA   FORD       RED     12000   Jim Smith

   Jim Smith   11 Jan 1980              J111BBB   SKODA      BLUE    11000   Jim Smith

   Bob Smith   23 Mar 1981              A155BDE   MERCEDES   BLUE    22000   Bob Smith

   Bob Jones   3 Dec 1986               K555GHT   FIAT       GREEN   6000    Bob Jones

                                        SC04BFE   SMART      BLUE    13000
Examples
- Find All Cars
- Find Cars Reg. Numbers
- Find Color and owner of each car
- Find Reg. Number of Red Cars
- Find all drivers born between 1995 and 1999
- Find Cars Reg. Numbers which price between 5000 and 12000
- Find Cars with no owners ( select regno from car where owner is NULL)
- Find Cars Owned by Jim Smith
- Find Cars which colors are green and red
- Find the car which has the maximum price
- Find the summation of cars prices
- Find the count of cars which have color blue
Examples
Examples
- Find Employees who don't live in London
- Find Employees who live in London and Seattle and Redmon
         ( IN,OR)
- Find Employees in ascending order of city and
        descending order of country
- Find Employees that their first name doesn't start with 'M'
- Find Employees that their salary are less than 1500
- Find Numbers of employees
Examples
               LOCATION                                   DEPARTMENT

 Location_ID             Regional_Group   Department_ID      Name      Location_ID

       122                    NEW YORK         10         ACCOUNTING      122

       123                     DALLAS          20          RESEARCH       124

       124                    CHICAGO          30           SALES         123

       167                    BOSTON           40         OPERATIONS      167


             JOB

Job_ID             Function

 667               CLERK

 668                STAFF

 669               ANALYST

 670           SALESPERSON

 671            MANAGER

 672            PRESIDENT
Examples
                                                     EMPLOYEE

EMPLOYEE_ID   LAST_NAME   FIRST_NAME   MIDDLE_NAME    JOB_ID   MANAGER_ID   HIREDATE   SALARY   COMM   DEPARTMENT_I
                                                                                                            D


   7369        SMITH        JOHN           Q           667       7902       17-DEC-     800     NULL       20
                                                                               84

   7499        ALLEN        KEVIN           J          670       7698       20-FEB-    1600     300        30
                                                                              85

   7505        DOYLE        JEAN           K           671       7839       04-APR-    2850     NULL       30
                                                                              85

   7506        DENNIS       LYNN           S           671       7839       15-MAY-    2750     NULL       30
                                                                               85

   7507        BAKER       LESLIE          D           671       7839       10-JUN-    2200     NULL       40
                                                                              85

   7521        WARK        CYNTHIA         D           670       7698       22-FEB-    1250     500        30
                                                                              85
Examples
- List all the employee details
- List all the department details
- List all job details
- List all the locations
- List out first name,last name,salary, commission for all employees
- List out employee_id,last name,department id for all employees and
      rename employee id as “ID of the employee”, last name as
      “Name of the employee”, departmentid as “department ID”
- List out the employees annual salary with their names only.
- List the details about “SMITH”
- List out the employees who are working in department 20
- List out the employees who are earning salary
     between 3000 and 4500
Examples
- List out the employees who are working in department 10 or 20
- Find out the employees who are not working in department 10 or 30
- List out the employees whose name starts with “S”
- list out the employees who are not receiving commission.
- List out the employee id, last name in ascending order
      based on the employee id.
 - List out the employee id, name in descending order
      based on salary column
- list out the employee details according to their last_name in
       ascending order and salaries in descending order
- How many employees who are working in different departments
       wise in the organization
Examples
- List out the department wise maximum salary, minimum salary,
     average salary of the employees
- List out the job wise maximum salary, minimum salary,
     average salaries of the employees
- Display the employee who got the maximum salary.
- Display the employees who are working in Sales department
- Display the employees who are working as “Clerk”.
- Display the employees who are working in “New York”
- Update the employees salaries, who are working as Clerk
    on the basis of 10%.
- Delete the employees who are working in accounting department.
- Create trigger on employees on save make comm = 0.25 of salary

Más contenido relacionado

Último

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Último (20)

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 

Destacado

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

PHP Oracle DB Dynamic Websites SQL Examples

  • 1. Dynamic Websites PHP with Oracle DB By Belal Arfa
  • 2. Section 4 In this section will discuss 1- SQL Practical Examples
  • 3. Examples Schema: Beers(name, made_by) Bars(name, addr, license) Drinkers(name, addr, phone) Likes(drinker, beer) Sells(bar, beer, price) Frequents(drinker, bar) Question: What beers are made by John Smith? Answer: SELECT name FROM Beers WHERE made_by= 'John Smith'; Note single quotes for strings.
  • 4. Examples - The database is formed from 2 tables, CAR and DRIVER. - Each car may be owned by a DRIVER. - A DRIVER may own multiple CARs. Driver Car Driver Car REGNO Make Color Price Owner NAME DOB F611AAA FORD RED 12000 Jim Smith Jim Smith 11 Jan 1980 J111BBB SKODA BLUE 11000 Jim Smith Bob Smith 23 Mar 1981 A155BDE MERCEDES BLUE 22000 Bob Smith Bob Jones 3 Dec 1986 K555GHT FIAT GREEN 6000 Bob Jones SC04BFE SMART BLUE 13000
  • 5. Examples - Find All Cars - Find Cars Reg. Numbers - Find Color and owner of each car - Find Reg. Number of Red Cars - Find all drivers born between 1995 and 1999 - Find Cars Reg. Numbers which price between 5000 and 12000 - Find Cars with no owners ( select regno from car where owner is NULL) - Find Cars Owned by Jim Smith - Find Cars which colors are green and red - Find the car which has the maximum price - Find the summation of cars prices - Find the count of cars which have color blue
  • 7. Examples - Find Employees who don't live in London - Find Employees who live in London and Seattle and Redmon ( IN,OR) - Find Employees in ascending order of city and descending order of country - Find Employees that their first name doesn't start with 'M' - Find Employees that their salary are less than 1500 - Find Numbers of employees
  • 8. Examples LOCATION DEPARTMENT Location_ID Regional_Group Department_ID Name Location_ID 122 NEW YORK 10 ACCOUNTING 122 123 DALLAS 20 RESEARCH 124 124 CHICAGO 30 SALES 123 167 BOSTON 40 OPERATIONS 167 JOB Job_ID Function 667 CLERK 668 STAFF 669 ANALYST 670 SALESPERSON 671 MANAGER 672 PRESIDENT
  • 9. Examples EMPLOYEE EMPLOYEE_ID LAST_NAME FIRST_NAME MIDDLE_NAME JOB_ID MANAGER_ID HIREDATE SALARY COMM DEPARTMENT_I D 7369 SMITH JOHN Q 667 7902 17-DEC- 800 NULL 20 84 7499 ALLEN KEVIN J 670 7698 20-FEB- 1600 300 30 85 7505 DOYLE JEAN K 671 7839 04-APR- 2850 NULL 30 85 7506 DENNIS LYNN S 671 7839 15-MAY- 2750 NULL 30 85 7507 BAKER LESLIE D 671 7839 10-JUN- 2200 NULL 40 85 7521 WARK CYNTHIA D 670 7698 22-FEB- 1250 500 30 85
  • 10. Examples - List all the employee details - List all the department details - List all job details - List all the locations - List out first name,last name,salary, commission for all employees - List out employee_id,last name,department id for all employees and rename employee id as “ID of the employee”, last name as “Name of the employee”, departmentid as “department ID” - List out the employees annual salary with their names only. - List the details about “SMITH” - List out the employees who are working in department 20 - List out the employees who are earning salary between 3000 and 4500
  • 11. Examples - List out the employees who are working in department 10 or 20 - Find out the employees who are not working in department 10 or 30 - List out the employees whose name starts with “S” - list out the employees who are not receiving commission. - List out the employee id, last name in ascending order based on the employee id. - List out the employee id, name in descending order based on salary column - list out the employee details according to their last_name in ascending order and salaries in descending order - How many employees who are working in different departments wise in the organization
  • 12. Examples - List out the department wise maximum salary, minimum salary, average salary of the employees - List out the job wise maximum salary, minimum salary, average salaries of the employees - Display the employee who got the maximum salary. - Display the employees who are working in Sales department - Display the employees who are working as “Clerk”. - Display the employees who are working in “New York” - Update the employees salaries, who are working as Clerk on the basis of 10%. - Delete the employees who are working in accounting department. - Create trigger on employees on save make comm = 0.25 of salary