Answer the query using SQL. For each department that controls more than 3 projects, retrieve the department number and department name.
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.
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;
Step by step
Solved in 3 steps with 2 images