Answer the query using SQL. For each department that controls more than 3 projects, retrieve the department number and department name.

Oracle 12c: SQL
3rd Edition
ISBN:9781305251038
Author:Joan Casteel
Publisher:Joan Casteel
Chapter12: Subqueries And Merge Statements
Section: Chapter Questions
Problem 5RQ
icon
Related questions
Question
Answer the query using SQL.
For each department that controls more than 3 projects, retrieve the department number and
department name.
Transcribed Image Text:Answer the query using SQL. For each department that controls more than 3 projects, retrieve the department number and department name.
Expert Solution
Step 1

Introduction of DBMS:

A database is a collection of data that are used to produce useful information e.g. Department database may consist of Department information like Department Name, Department Number, Number of Projects, Department Floor, etc. DBMS(Database Management System) is a software to store and retrieve data. So to store department records we have to create a table, insert data into the table, etc. So DBMS is used for the structure of the database and manipulates the data in the database e.g. Oracle, SQL Server, My SQL, etc are DBMS software to maintain database and these databases mostly use SQL(Structured Query Language) language.

Step 2

SQL Query to create a table Department: 

CREATE TABLE Department(DepartmentName char(10), DepartmentNumber varchar(10),NumberOfProject int, DepartmentFloor varchar(5));

SQL Query to insert data into the table Department:

INSERT INTO Department VALUES('Science','Dept1',8,'2nd');
INSERT INTO Department VALUES('Mathematics','Dept2',5,'1st');
INSERT INTO Department VALUES('Computer','Dept3',4,'5th');
INSERT INTO Department VALUES('Finance','Dept4',2,'3rd');
INSERT INTO Department VALUES('Account','Dept5',3,'4th');

SQL Query to retrieve information of the table:

SELECT * FROM Department;

Computer Science homework question answer, step 2, image 1

 

steps

Step by step

Solved in 3 steps with 2 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.
Recommended textbooks for you
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage