Professional Documents
Culture Documents
ADBMS Lab Manual BTECH CSE 4th Sem
ADBMS Lab Manual BTECH CSE 4th Sem
INDEX
EXPERIMENT NO.: 01
DEV BHOOMI UTTARAKHAND UNIVERSITY
Title of Experiment: DDL Commands - Table Creation, Altering the table structures,
truncating a table and dropping a table.
Program: Course: Advance Database Management System Semester:
B.TECH CSE IV
Code:21BTCS482
Page no: 1
Experiment: - 1. DDL Commands - Table Creation, Altering the table structures, truncating a
table and dropping a table.
Solution:
Table Creation:
CREATE TABLE Employees (
EmployeeID INT PRIMARY KEY,
FirstName VARCHAR(50),
LastName VARCHAR(50),
Email VARCHAR(100) UNIQUE,
HireDate DATE
);
Truncating a Table:
Dropping a Table:
EXPERIMENT NO.: 02
DEV BHOOMI UTTARAKHAND UNIVERSITY
Title of Experiment: DML Commands - Insert, Select Commands, update & delete
Commands.
Program: Course: Advance Database Management System Semester:
B.TECH CSE IV
Code:21BTCS482
Page no: 2
Experiment: - 2. DML Commands - Insert, Select Commands, update & delete Commands.
Solution:
Insert Command:
INSERT INTO Employees (FirstName, LastName, Email, HireDate)
VALUES ('John', 'Doe', 'john.doe@example.com', '2023-01-15');
```
Select Command
Update Command:
UPDATE Employees
SET FirstName = 'Jane', LastName = 'Doe'
WHERE EmployeeID = 1;
```
Delete Command:
Experiment: - 3. Practice Queries using COUNT, SUM, AVG, MAX, MIN, GROUP BY, HAVING,
VIEWS Creation and Dropping.
Solution:
SELECT department_id,
COUNT(*) AS num_employees,
SUM(salary) AS total_salary,
AVG(salary) AS avg_salary,
MAX(salary) AS max_salary,
MIN(salary) AS min_salary
FROM employees
GROUP BY department_id;
SELECT department_id,
COUNT(*) AS num_employees,
AVG(salary) AS avg_salary
FROM employees
GROUP BY department_id
HAVING AVG(salary) > 50000;
Creating a View:
Dropping a View:
Join Queries:
Join queries are used to retrieve data from multiple tables based on a related column between
them. There are different types of joins such as INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN.
Here's an example:
Nested Queries:
Nested queries, also known as subqueries, are queries within another query. They are used to
retrieve data based on conditions that involve the results of another query. Here's an example:
SELECT CustomerName
FROM Customers
WHERE CustomerID IN (SELECT CustomerID FROM Orders);
DEV BHOOMI UTTARAKHAND UNIVERSITY
EXPERIMENT NO.: 05
Title of Experiment: Creating a database and to set various possible constraints.
Program: Course: Advance Database Management System Semester:
B.TECH CSE IV
Code:21BTCS482
Page no: 5
Experiment: - 5. Creating a database and to set various possible constraints.
Solution:
EXPERIMENT NO.: 06
Title of Experiment: Implementation of foreign key on database.
Program: Course: Advance Database Management System Semester:
B.TECH CSE IV
Code:21BTCS482
Page no: 6
Experiment: - 6. Implementation of foreign key on database.
Solution: