1692 Lab
1692 Lab
Submitted To
Ms. Rimi Akter (RIA)
Designation :Lecturer
Department of CSE,Daffodil International University
Submitted By
Student ID:02422220005101692
Section:63_L1
Student Name: Ankon Mazumder
Experiment Details:
Objective:
The primary objective of this lab was to perform basic CRUD (Create, Read, Update, Delete) operations in a
relational database system. This experiment helps understand how to interact with a database using SQL
queries, maintain data integrity, and manage records efficiently.
Environment Setup:
Database Management System:[e.g.,MySQL,PostgreSQL]
· Tools:[e.g.,MySQL Workbench,pgAdmin,etc.]
·Operating System:[Insert OS Name]
Tasks Performed:
1. Create: Create a table named students with attributes id, name, email, and grade.
2. Read: Retrieve all records from the students table.
3. Update: Modify a specific student's grade.
4. Delete: Remove a record from the students table.
3. Read Data
SQL:
SELECT*FROM students;
4. Update Data
SQL:
5. Delete Record
SQL:
Obtained Output:
1 John [email protected] A
Observation/Comments:
Appendix A: Course Outcomes, Complex Engineering Problems (EP) and Complex Engineering Activities (EA)
Addressing.
Table: CSE312 Course Outcomes (COs) with Mappings
Complex Complex
Learning Knowledge Engineering
COs CO Statements POs Engineering
Domains Profile Problem Activities
The lab activity involves
performing CRUD
operations,which C2 K2
demonstrate a foundational A2 K3 EP1
CO1 PO1
understanding of database P2 K4 EP4
concepts like the relational K8
data model,normalization,and
SQL basics.
Submitted To
Ms.Rimi Akter (RIA)
Designation: Lecturer
Department of CSE,Daffodil International University
Submitted By
Student ID:02422220005101692
Section:63_L1
Student Name: Ankon Mazumder
Experiment Details:
Introduction:
Aggregate functions in SQL,such as SUMO,AVGO,COUNTO, MINO, and MAXO), are used to perform
calculations on a set of values and return a single value. Combining these functions with the clauses
LIMIT,BETWEEN,and IN enhances query flexibility and allows precise data analysis. This experiment
focuses on their practical usage in managing and querying a database.
Procedure:
1. Setup the Database
c. COUNTO with IN
Query: Count the number of employees in the HR and IT departments.
Obtained Output:
Observation/Comments: Using these clauses efficiently can significantly reduce the amount of data
processed,making queries faster.
Demonstrate a comprehensive K2
understanding of fundamental K3
C2
database management concepts, K4 EP1
CO1 PO1 A2 EP4
including the relational data K8
P2
model,normalization
techniques,and SQL basics.
Design, implement and optimize
K2
relational databases,incorporating C3 K3 EP1
CO2 advanced SQL queries, indexing PO3 A3 K4 EP2 EA3
techniques and query optimization P3 K6 EP7
K8
strategies.
of Conflicting
Requirement S
Submitted To
Ms. Rimi Akter (RIA)
Designation Lecturer
Department of CSE,Daffodil International University
Submitted By
Student ID:02422220005101692
Section:63_L1
Student Name: Ankon Mazumder
Experiment Details:
Introduction:
JOIN operations are fundamental to relational databases, enabling the combination of data from multiple
tables to produce insightful and comprehensive datasets. These operations are crucial in scenarios where data
is normalized and stored across different tables to minimize redundancy and improve database management.
Understanding and effectively utilizing JOINs can greatly enhance the ability to query,analyze, and present data
in a meaningful way.
Procedure:
1. Setup the Database
1.INNER JOIN
Query:This type returns rows that have matching values in both tables.
2.LEFT JOIN
Query:This type returns all rows from the left table and the matched rows from the right table. If no match
is found,NULL values are returned for columns from the right table.
SELECT e.EmployeeID,e.Name,d.DepartmentName
FROM Employees e
LEFT JOIN Departments d ON e.Department=d.DepartmentID;
3.RIGHT JOIN
Query: This type returns all rows from the right table and the matched rows from the left table. If no match
is found, NULL values are returned for columns from the left table.
SELECT e.EmployeeID,e.Name,d.DepartmentName
FROM Employees e
RIGHT JOIN Departments d ON e.Department=d.DepartmentID;
4.FULL JOIN
Query: This type returns rows when there is a match in one of the tables. It returns all rows from the left table and from the right
table.
SELECT e.EmployeeID,e.Name,d.DepartmentName
FROM Employees e
FULL OUTER JOIN Departments d ON e.Department=d.DepartmentID;
Obtained Output:
1. 2. Desired
EmployeelD Name DepartmentName EmployeelD Name DepartmentName Output?
Alice HR 1 Alice NULL
Bob Finance 2 Bob NULL
Charlile IT
David IT 3 Charlie NULL
HR 4 David NULL
Eve
EmployeelD Name DepartmentName
3. YES
Observation/ Comments: Ideal for queries where you need to report or analyze data where the relationship between the tables is
mandatory
Appendix A: Course Outcomes,Complex Engineering Problems (EP) and Complex Engineering Activities (EA)
Addressing.
strategies.
of Knowledge
required
EP2:Range of
02 Yes/No CO2
Conflicting
Requirement
S
Submitted To
Ms. Rimi Akter (RIA)
Designation Lecturer
Department of CSE,Daffodil International University
Submitted By
Student ID:02422220005101692
Section:63_L1
Student Name: Ankon Mazumder
Experiment Details:
Introduction:
Stored procedures are precompiled SQL statements that can be executed on demand. They are used to
encapsulate repetitive tasks, enforce business logic, and improve performance.
Views are virtual tables created by a query that joins and simplifies mnultiple tables into a single, easily
accessible structure. They do not store data themselves but provide a way to lookat data from one or more
tables.
Procedure:
1. Setup the Database
1.stored procedure
Query: We'll create a stored procedure to retrieve employees' details by department.
CREATE PROCEDURE GetEmployeesbyDepartment(IN deptlane VARCHAPR(58))BEGTNI SELECT e.EmployeeID,e.lame,e.Salary,e.JoiningDate,d.Departnentlane FRONW Enployees e IMER JOIN Departments
d ON e.Department = d.Department ID WHERE d.Departmentlane= deptllame; ENO;
CALL GetEmployeesByDepartment('IT');
2.view
Query: We'll create a view to consolidate employee details with their department names.
CREATE VIEN EmployeeDetailsView AS SELECT e.EnployeeID, e.Name, e.Salary, e.JoiningDate, d.DepartmentNane FROM Employees e INMER JOIN Departments d ON
e.Department=d.DepartmentID;
SELECT*FROM EmployeeDetailsView;
Obtained Output:
1. 2.
EmployeelD Name Salary JoiningDate DepartmentName
Employeell Name SdbaryJimingDateDeparmentane 1 Alice 5000.00 2020-01-15 HR
Observation/Comments: Both views and stored procedures are powerful tools in SQL that provide different advantages
depending on the use case. Together, they help improve database management,performance,and security.
Appendix A: Course Outcomes,Complex Engineering Problems (EP) and Complex Engineering Activities (EA)
Addressing.
Complex Complex
Learning Knowledge
COs CO Statements POs Engineering Engineering
Domains Profile
Problem Activities
Demonstrate a comprehensive
understanding of fundamental K2
C2
database management K3 EP1
CO1 PO1 A2
concepts,including the relational K4 EP4
P2
data K8
model,normalization
techniques,and SQL basics.
Design, implement and optimize
K2
relational databases,incorporating C3 K3 EP1
CO2 advanced SQL queries, indexing PO3 A3 K4 EP2 EA3
techniques and query optimization P3 K6 EP7
K8
strategies.
Topic:Implementation of Trigger
Submitted To
Ms. Rimi Akter (RIA)
Designation:Lecturer
Department of CSE,Daffodil International University
Submitted By
Student ID:02422220005101692
Section:63_L1
Student Name: Ankon Mazumder
Experiment Details:
Objective:
The primary objective of this lab was to perform basic CRUD (Create, Read, Update, Delete) operations in a relational
database system. This experiment helps understand how to interact with a database using SQL queries,maintain data
integrity, and manage records efficiently.
Key Learning Outcomes:
1. Create: Create a table named students with attributes id, name, email, and grade.
2. Read: Retrieve all records from the students table.
3. Update: Modify a specific student's grade.
4. Delete: Remove a record from the students table.
Example Usage
Suppose we update an employee's salary:
Obtained Output:
Alternative Steps/Solution (If any):
Observation/Comments:
Triggers are a powerful tool for automating database management tasks, enforcing business rules,and maintaining
data integrity. They provide a way to ensure that specific actions are taken in response to data changes, enhancing the
reliability and robustness of your database systems.
Appendix A: Course Outcomes, Complex Engineering Problems (EP) and Complex Engineering Activities (EA)
Addressing.
Complex Complex
Learning Knowledge
COs CO Statements POs Engineering Engineering
Domains Profile
Problem Activities
The lab activity involves performing
CRUD operations,which demonstrate
K2
C2
a foundational understanding of K3 EP1
CO1 PO1 A2
database concepts like the relational K4 EP4
P2
K8
data model,normalization,and SQL
basics.
K2
This activityinvolves optimizing and
C3 K3
designing relational databases through K4 EP1
CO2 PO3 A3 EA3
structured SQL queries,fulfilling CO2 P3 K6
requirements. K8
Table: Addressing CO (1 to 3), Knowledge Profile (K),Attainment of Complex Engineering
Problems (EP):
SN EngineeringProblem Attain CO Justification
(EP) Definition Ment (with Knowledge Profile)