By using this table answer this question in SQL:   Show the department id, department name and the number of employees working in any department which has less than 4 employees

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

By using this table answer this question in SQL:

 

Show the department id, department name and the number of employees working in any department which has less than 4 employees


 

JOB_HISTORY
JOBS
PF' EMPLOYEE_ID
P' START_DATE
* END_DATE
JOB_ID
DEPARTMENT_ID
P JOB_ID
* JOB_TITLE
MIN_SALARY
MAX_SALARY NUMBER (6)
NUMBER (0)
VARCHAR2 (10 BYTE)
VARCHAR2 (35 BYTE)
DATE
DATE
NUMBER (8)
VARCHAR2 (10 BYTE)
NUMBER (4)
JOB_ID_PK
O IDX_JOB_TITLE
JHIST_EMP_ID_ST_DATE_PK
O JHIST_JOB_IX
JHIST_EMPLOYEE_IX
O JHIST_DEPARTMENT_IX
DEPARTMENTS
DEPARTMENT_ID
DEPARTMENT_NAME
MANAGER_ID
NUMBER (4)
VARCHAR2 (30 BYTE)
F
NUMBER (8)
NUMBER (4)
EMPLOYEES
LOCATION_ID
EMPLOYEE_ID
FIRST_NAME
* LAST NAME
U' EMAIL
NUMBER (6)
VARCHAR2 (20 BYTE)
VARCHAR2 (25 BYTE)
VARCHAR2 (25 BYTE)
VARCHAR2 (20 BYTE)
DEPT_ID_PK
DEPT_LOCATION_IX
PHONE_NUMBER
HIRE_DATE
JOB_ID
SALARY
DATE
VARCHAR2 (10 BYTE)
LOCATIONS
NUMBER (8.2)
COMMISSION_PCT
F
MANAGER_ID
F
DEPARTMENT_ID
NUMBER (2.2)
NUMBER (8)
NUMBER (4)
LOCATION_ID
STREET_ADDRESS
POSTAL_CODE
* CITY
NUMBER (4)
VARCHAR2 (40 BYTE)
VARCHAR2 (12 BYTE)
STATE_PROVINCE
F
VARCHAR2 (30 BYTE)
VARCHAR2 (25 BYTE)
CHAR (2 BYTE)
EMP_EMAIL_UK
EMP_EMP_ID_PK
O EMP_DEPARTMENT_IX
O EMP_JOB_IX
O EMP_MANAGER_IX
O EMP_NAME_IX
O IDX SALARY
COUNTRY_ID
LOC_ID_PK
O LOC_CITY_IX
O LOC_STATE_PROVINCE_IX
O LOC_COUNTRY_Ix
Y--
EMP_DETAIL S_VIEW
COUNTRIES
NUMBER (6)
VARCHAR2 (1O)
EMPLOYEE_ID
COUNTRY_ID
CHAR (2 BYTE)
JOB_ID
MANAGER_ID
DEPARTMENT_ID
COUNTRY_NAME
VARCHAR2 (40 BYTE)
NUMBER (8)
F
REGION_ID
NUMBER
NUMBER (4)
COUNTRY_C_ID_PK
LOCATION_ID
COUNTRY_ID
FIRST_NAME
LAST_NAME
NUMBER (4)
CHAR (2)
VARCHAR2 (20)
VARCHAR2 (25)
NUMBER (8, 2)
SALARY
REGIONS
COMMISSION_PCT
DEPARTMENT_NAME VARCHAR2 (30)
JOB_TITLE
NUMBER (2, 2)
P REGION_ID
NUMBER
VARCHAR2 (35)
REGION_NAME
VARCHAR2 (25 BYTE)
VARCHAR2 (30)
VARCHAR2 (25)
VARCHAR2 (40)
VARCHAR2 (25)
CITY
REG_ID_PK
STATE_PROVINCE
COUNTRY_NAME
REGION_NAME
Transcribed Image Text:JOB_HISTORY JOBS PF' EMPLOYEE_ID P' START_DATE * END_DATE JOB_ID DEPARTMENT_ID P JOB_ID * JOB_TITLE MIN_SALARY MAX_SALARY NUMBER (6) NUMBER (0) VARCHAR2 (10 BYTE) VARCHAR2 (35 BYTE) DATE DATE NUMBER (8) VARCHAR2 (10 BYTE) NUMBER (4) JOB_ID_PK O IDX_JOB_TITLE JHIST_EMP_ID_ST_DATE_PK O JHIST_JOB_IX JHIST_EMPLOYEE_IX O JHIST_DEPARTMENT_IX DEPARTMENTS DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID NUMBER (4) VARCHAR2 (30 BYTE) F NUMBER (8) NUMBER (4) EMPLOYEES LOCATION_ID EMPLOYEE_ID FIRST_NAME * LAST NAME U' EMAIL NUMBER (6) VARCHAR2 (20 BYTE) VARCHAR2 (25 BYTE) VARCHAR2 (25 BYTE) VARCHAR2 (20 BYTE) DEPT_ID_PK DEPT_LOCATION_IX PHONE_NUMBER HIRE_DATE JOB_ID SALARY DATE VARCHAR2 (10 BYTE) LOCATIONS NUMBER (8.2) COMMISSION_PCT F MANAGER_ID F DEPARTMENT_ID NUMBER (2.2) NUMBER (8) NUMBER (4) LOCATION_ID STREET_ADDRESS POSTAL_CODE * CITY NUMBER (4) VARCHAR2 (40 BYTE) VARCHAR2 (12 BYTE) STATE_PROVINCE F VARCHAR2 (30 BYTE) VARCHAR2 (25 BYTE) CHAR (2 BYTE) EMP_EMAIL_UK EMP_EMP_ID_PK O EMP_DEPARTMENT_IX O EMP_JOB_IX O EMP_MANAGER_IX O EMP_NAME_IX O IDX SALARY COUNTRY_ID LOC_ID_PK O LOC_CITY_IX O LOC_STATE_PROVINCE_IX O LOC_COUNTRY_Ix Y-- EMP_DETAIL S_VIEW COUNTRIES NUMBER (6) VARCHAR2 (1O) EMPLOYEE_ID COUNTRY_ID CHAR (2 BYTE) JOB_ID MANAGER_ID DEPARTMENT_ID COUNTRY_NAME VARCHAR2 (40 BYTE) NUMBER (8) F REGION_ID NUMBER NUMBER (4) COUNTRY_C_ID_PK LOCATION_ID COUNTRY_ID FIRST_NAME LAST_NAME NUMBER (4) CHAR (2) VARCHAR2 (20) VARCHAR2 (25) NUMBER (8, 2) SALARY REGIONS COMMISSION_PCT DEPARTMENT_NAME VARCHAR2 (30) JOB_TITLE NUMBER (2, 2) P REGION_ID NUMBER VARCHAR2 (35) REGION_NAME VARCHAR2 (25 BYTE) VARCHAR2 (30) VARCHAR2 (25) VARCHAR2 (40) VARCHAR2 (25) CITY REG_ID_PK STATE_PROVINCE COUNTRY_NAME REGION_NAME
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Multiple table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education