0% found this document useful (0 votes)
181 views

DBMS Lab Manual R-19

The document provides information about the vision, mission, program educational objectives, program outcomes, and laboratory outcomes of the Artificial Intelligence Machine Learning department. It also includes general instructions for laboratory work and guidelines for laboratory assessment.

Uploaded by

neeraj patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
181 views

DBMS Lab Manual R-19

The document provides information about the vision, mission, program educational objectives, program outcomes, and laboratory outcomes of the Artificial Intelligence Machine Learning department. It also includes general instructions for laboratory work and guidelines for laboratory assessment.

Uploaded by

neeraj patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

SIES GST, NERUL, NAVI MUMBAI

DEPARTMENT OF ARTIFICIAL INTELLIGENCE MACHINE LEARNING

LAB MANUAL

DATABASE MANAGEMENT LAB

(CSL 402)

B.E. (ARTIFICIAL INTELLIGENCE MACHINE LEARNING)


SEMESTER-IV
(R-2019)-Ver1
ARTIFICIAL INTELLIGENCE MACHINE LEARNING DEPARTMENT

DEPARTMENT’S VISION

Impart prime content education to develop technically proficient and socially responsible
engineers in the emerging branches of AI.

DEPARTMENT’S MISSION

1. To provide students with a comprehensive education to prepare them for the rigors in the
domain of AI

2. To establish a platform for academics, innovation, professional growth, and social


interaction.

3. To encourage the capacity for lifelong learning necessary for career advancement.

4. To help build relationships with alumni and industry for the betterment of students' overall
growth.

PROGRAMME EDUCATIONAL OBJECTIVES(PEOs)

⚫ PEO1: Develop leadership abilities for professional advancement.

⚫ PEO2: Pursue higher education to learn and advance their careers.

⚫ PEO3: Promote services in the field of Artificial Intelligence Engineering through excellent
technical and communication skills.

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 2


PROGRAMME OUTCOMES (POs)

PO1: Engineering knowledge: Apply the knowledge of mathematics science engineering


fundamentals and an mathematics, science, engineering fundamentals, and an engineering
specialization to the solution of complex engineering problems engineering problems.
PO2: Problem analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of mathematics,
natural sciences, and engineering sciences.
PO3: Design/development of solutions: Design solutions for complex engineering problems and
design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and environmental
considerations
PO4: Conduct investigations of complex problems: Use research-based knowledge and research
methods including design of experiments, analysis and interpretation of data, and synthesis of
the information to provide valid conclusions.
PO5: Modern tool usage: Create, select, and apply appropriate techniques, resources, and
modern engineering and IT tools including prediction and modeling to complex engineering
activities with an understanding of the limitations.
PO6: The engineer and society: Apply reasoning informed by Apply reasoning informed by the
contextual knowledge to assess societal, health, safety, legal and cultural issues and the
consequent responsibilities legal and cultural issues and the consequent responsibilities relevant
to the professional engineering practice.
PO7: Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need
for sustainable development and need for sustainable development.
PO8: Ethics: Apply ethical principles and commit to professional ethics and responsibilities and
norms of the engineering practice.
PO9: Individual and team work: Function effectively as an individual and as a member or leader
in diverse teams and individual, and as a member or leader in diverse teams, and in
multidisciplinary settings.
PO10: Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write
effective reports and design documentation, and write effective reports and design
documentation, make effective presentations, and give and receive clear instructions.
PO11: Project management and finance: Demonstrate knowledge and understanding of the
engineering and knowledge and understanding of the engineering and management principles
and apply these to one’s own work, as a member and leader in a team, to manage projects and in
multidisciplinary environments.

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 3


PO12: Life-long learning: long learning: Recognize the need for and have the Recognize the
need for, and have the preparation and ability to engage in independent and lifelong learning in
the broadest context of technological change.

PROGRAMME SPECIFIC OUTCOMS (PSOs )

⚫ PSO1: Students are exposed to cutting-edge trends and technology to prepare them for
challenging work in the industry, higher education, and professional careers.

⚫ PSO2: Practice skills learnt in the field of Artificial Intelligence, Data Mining. Machine
Learning, Cloud Computing, Optimization, Networking and Security, Deep Learning to
different domains such as Healthcare, Education, Agriculture, Finance, Social Media etc.

GENERAL INSTRUCTIONS (Do's And Don'ts)

1. Wearing ID-Card is compulsory.


2. Keep your bag at the specified place.
3. Shut down the system after use.
4. Place the chairs in proper position before leaving the laboratory.
5. Report failure/Non-working of equipment to Faculty In-charge / Technical Support staff
immediately.
6. Know the location of the fire extinguisher and the FIRST-AID Box and how to use then
in case of an emergency.
7. Do not eat or drink in the laboratory.
8. Do not litter in the laboratory.
9. Avoid stepping on electrical wires or any other computer cables.
10. Do not open the system unit casing or monitor casing particularly when the power in turn
ON.
11. Do not insert metal objects such as clips, pins and needles into the computer casing. They
may cause fire.
12. Do not remove anything from laboratory without permissions.
13. Do not touch, connect or disconnect any plug or cable without permission.

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 4


LAB OUTCOMES (LO)

LO1: Design and draw ER and EER diagram for the real life problem with software tool.
LO2: Create and update database and tables with different DDL and DML statements.
LO3: Apply /add integrity constraints and able to provide security to data.
LO4: Implement and execute complex queries.
LO5: Apply triggers and procedures for specific module/task

LAB ARTICULATION MATRIX (MAPPING WITH PO & PSO)

PS PS
Course Outcomes (COs) / Program Outcomes (POs) 1 2 3 4 5 6 7 8 9 10 11 12 O1 O2

CO1 Design and draw ER and EER diagram for the 3 3 3


real life problem with software tool.

CO2 Create and update database and tables with 3 3 3


different DDL and DML statements.

CO3 Apply /add integrity constraints and able to 3 3 3


provide security to data.

CO4 Implement and execute complex queries. 3 3 3

CO5 Apply triggers and procedures for specific 3 3 3


module/task

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 5


Laboratory Assessment

Academic Year: Class/Sem: Div: Batch:

Student Name: Roll No:

Course Name: Course Code:

1. Preparedness and Efforts/ Preparation and Knowledge

3: Well prepared and puts 2: Not prepared but puts 1: Neither prepared nor puts
efforts. efforts or prepared but doesn't efforts
put efforts

2. Presentation of output/ Accuracy and Neatness of Documentation

3: Uses all perfect Instructions 2: Uses some perfect 1: Doesn't use any of the
/ Interrupts/Presented well. Instructions / Interrupts/ proper Instruction / Interrupt/
moderate presentation. Not presented properly.

3. Results/ Participation in Practical Performance

3: Participate and gets proper 2: Participate but doesn't get 1: Neither Participate nor gets
results proper result or gets result but the results
with the help of faculty in-
charge

4. Punctuality

3: Get the experiment 2: Some time delays the 1: Most of the time delays
checked in-time and is always experiment checking or is late experiment checking and / or
in-time to the lab sessions to the lab sessions for few comes late for lab sessions
times

5. Lab Ethics
3: Follows proper lab ethics 2: Sometimes doesn't follow 1: Most of the times makes
by keeping the lab clean and
placing things at their right the lab ethics the lab untidy and keeps
place things at wrong place

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 6


VALUATION:

Performance Indicator/ 1 2 3 4 5 6 7 8 9 10 Total


Expt. No
LO1 LO1 LO2 LO2 LO3 LO4 LO3 LO3, NA NA
LO4
1. Preparedness and
Efforts/ Preparation and
Knowledge
2. Presentation of
output/ Accuracy and
Neatness of
Documentation
3. Debugging and
results/ Participation in
Practical Performance
4. Punctuality

5. Lab Ethics

Total

Average

Exceed Expectations (3), Meet Expectations (2). Below Expectations (1)

Faculty In-charge

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 7


LIST OF EXPERIMENTS

Expt. No. Name of the Experiment CO Mapping


Identify the case study and detail statement of problem. Design an LO1

1 Entity-Relationship (ER) / Extended Entity-Relationship (EER)


Model.
Mapping ER/EER to Relational schema model. LO1
2

To implement DDL commands with integrity constraints in SQL. LO2


3

To execute basic SQL queries on a given database. LO2


4

Perform Simple queries, using string manipulation operations and LO3


5
date functions.
6 Perform Join operations. LO2

7 Perform Aggregate functions, group by and having clause LO4

8 Perform Set operations. LO4

9 Implementation of Views and Triggers. LO5

10 Implementation of Functions, cursor and procedure. LO5

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 8


Experiment No. 1

Aim: Identify the case study of the problem and design ER model.

Q.1. NHL Hockey team ER model.

Justification:

In the given ER model,

Entities are: Teams and Players.

Each team has multiple players and each player has to belong to at least one team,
so the cardinality from players to team is many to one. Players are given position
as primary key and a multi valued attribute called injury record. Each team has a
captain who is also the player. And since 1 team can have only 1 captain the
cardinality is one to one. A game is played between two teams, guest and host team

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 9


and so we show unary relation on entity ‘Team’. This relation game has attributes
as date of game and score.

Q.2. Hospital ER model.

Justification:

In the given ER model,

The entities are: Patient, Tests and Medical Doctors.

Each patient can have their patient id as primary key. Amongst other attributes,
address is a composite attribute. A patient is treated by only one doctor and one
doctor can treat multiple patients, so the cardinality from patient to doctor is many
to one. Since a patient will be treated and a doctor will treat someone, its total
participation from both ends. A doctor has multiple attributes out of which the
doctor’s id is a primary key and their qualifications are multivalued here. A patient
may or may not have to go through some tests so its partial participation from
patient’s side but total participation from tests end. A patient maybe told to take

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 10


multiple tests and a single test can be taken by multiple patients. Test is an entity
which has ‘type’ as a primary key.

Conclusion:

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 11


Experiment No. 2

Aim: Construct relational models for given ER designs.

ER for NHL hockey teams:

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 12


Relational Mapping:

ER model for Hospital:

Relational mapping:

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 13


Conclusion:

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 14


Experiment No. 3

Aim: To execute basic SQL queries on a given database.

Query and Output:

1. Display the entire employee table.

2. List all department names and their locations.

3. Display different job opportunities available for an employee.

4. Compute the entire details of employee named SMITH.

5. List all employees and their job who are in department number 20.

6. Display all details of the employee belonging to department number 30.

7. Display the name and employee number of all MANAGERS.

8. Display the name of all employees whose commission is greater than salary.

9. Display name and job of employees whose salary is greater than 2000.

10.Give list of all employee names along with their monthly and annual salary.

11. Display names and number of employees working in department number 10.

12. Give the detailed list of all the dept and deptno but change the column name as
DEPARTMENT and DEPARTMENT NUMBER.

13. List all the managers with their respective names, manager employee number
and dept no.

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 15


14. Find list of all employees whose employee numbers are greater than their
manager employee number.

15. Display list of all employees whose job is analyst and salary is greater than 1000.

16. Find details of all managers who are not in department number 10.

17. Compute details of those employees who are neither Clerk nor Salesman nor
Analyst.

18. Display name, salary and job of all employees ordered by their JOB.

19. List name, salary, job of all employees which are in descending order of their
SALARY and ascending order of their JOB.

20. Compute details of all employees in ascending order of JOB and descending
order by NAME.

Conclusion:

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 16


Experiment No.
17

Aim: To execute basic SQL queries on a given database.

Query and Output:

1. Display the entire employee table.


2. List all department names and their locations.
3. Display different job opportunities available for an employee.
4. Compute the entire details of employee named SMITH.
5. List all employees and their job who are in department number 20.
6. Display all details of the employee belonging to department number 30.
7. Display the name and employee number of all MANAGERS.
8. Display the name of all employees whose commission is greater than salary.
9. Display name and job of employees whose salary is greater than 2000.
10.Give list of all employee names along with their monthly and annual salary.
11. Display names and number of employees working in department number 10.
12. Give the detailed list of all the dept and deptno but change the column name as
DEPARTMENT and DEPARTMENT NUMBER.
13. List all the managers with their respective names, manager employee number
and dept no.
14. Find list of all employees whose employee numbers are greater than their
manager employee number.
15. Display list of all employees whose job is analyst and salary is greater than 1000.
16. Find details of all managers who are not in department number 10.
17. Compute details of those employees who are neither Clerk nor Salesman nor
Analyst.
18. Display name, salary and job of all employees ordered by their JOB.
19. List name, salary, job of all employees which are in descending order of their
SALARY and ascending order of their JOB.

20. Compute details of all employees in ascending order of JOB and descending
order by NAME.

Conclusion:

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 17


Experiment No.
18

Aim: Perform String and Date Functions

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 18


SIES GRADUATE SCHOOL OF TECHNOLOGY Page 19
Perform Following queries using String functions.

1. List all employee names whose second alphabet is 'D'.


2. Display names whose length is of 5 characters.
3. Join the contents of the dept names and their locations and give as one column
department.
4. List all the employee names with first letter in capital, uppercase, lowercase.

5. List all employee names with blank left and right padding.
6. List all employee names with character left and right padding.
7. Right trim all the employees names ending with N.
8. List the names of all department names.
9. List the first 3 characters of all employee names.
10. Find the location number of character 'A' in department name.

Date Formats

Perform following date formats using conversion function to_char()


Consider schema Emp(empno,ename,deptno,job,hiredate)

• YYY - year (4 digits)


• YYY: Last three digits of the year
• YY - Last 2 digits of year
• YEAR: Name of the year in uppercase
• Year: Name of the year with the first letter in uppercase
• DD - day of month (01–31)
• DDD: Three-digit day of the year
• D: One-digit day of the week
• DAY: Full name of the day in uppercase
• Day: Full name of the day with the first letter in uppercase
• DY: First three letters of the name of the day in uppercase
• Dy: First three letters of the name of the day with the first letter in uppercase
• MM - month number (01–12)
• MONTH: Full name of the month in uppercase, right-padded with spaces to
a total length of nine characters
• Month: Full name of the month with first letter in uppercase, right-padded
with spaces to a total length of nine characters

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 20


• Mon: First three letters of the name of the month with the first letter in
uppercase
• WW: Two-digit week of the year
• W: One-digit week of the month
• HH24: Two-digit hour in 24-hour format
• HH: Two-digit hour in 12-hour format
• MI: Two-digit minute
• SS: Two-digit second
• DDSPTH 'of' MONTH, YEAR A.D.

Date functions
Implement Following date functions:
1. Round(date,[precision])
2. trunc(date,[precision])
3. Add_months(date,number)
4. Last_day(date)
5. Next_day(day,daytime)
6. Months_between(date1,date2)

Write SQL and its output.


1. List names and hiredate of employees in dept 20.Diasplay the hiredate
formatted as ‘12/03/84’.
2. How many months has the president worked for the company? Round
to the nearest whole no of month.
3. Retrive the analyst records with hiredate formatted as ‘the 3rd of
December,1984’ .
4. List the names of all employees whose hiredate anniversary is in the
month of December.
5. Display who was the last emploee hired in each department.

Conclusion:

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 21


Experiment No. 6

Aim: To implement Join in SQL.

1. Display information of employee details with their dept details.


2. Perform left outer join.
3. Perform right outer join.
4. Perform full outer join.

Conclusion:

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 22


Experiment No. 7

Aim: To implement aggregate functions in SQL.

Aggregate Functions:

AVG() – returns the average of a set.

COUNT() – returns the number of items in a set.

MAX() – returns the maximum value in a set.

MIN() – returns the minimum value in a set

SUM() – returns the sum of all or distinct values in a set

Group By Clause:

The GROUP BY statement is often used with aggregate functions to group the
result set by one or more columns.

Having Clause:

The WHERE clause filters the rows from the result set based on the columns
specified in the WHERE clause condition, whereas the HAVING clause filters
the groups created by the GROUP BYclause from the result set based on the
conditions specified in the HAVING clause. HAVING clause is executed after
the GROUP BY clause.

Query & Output:

1. Count the no of employees.


2. Count the no of employees hired after 13th Jan 1981.
3. Calculate the sum of salaries of all employees.
4. Calculate the average of salaries of all employees.
5. Calculate the minimum of salaries of all employees.
6. Calculate the maximum of salaries of all employees.

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 23


7. Get the average, minimum, maximum salary of employees for each
dept .
8. Get the average, minimum, maximum salary of employees for each
dept having average salary >2000.
9. Get the minimum salary of employees for each job.
10.For each dept Get the minimum salary of employees who are
managers.
11.Get the minimum and maximum salary of employees for jobs in each
dept.
12.Get the number of available job opportunities.
13.Calculate 12 times the average salary.
14.Get the number of employees in each department.
15.Get the total salary for each department.
16. Get the total salary for each job.
17. Get the average annual salary for each job which has more than one
employee working on it.

18. Get the department no which has more than one clerk working under
it.
19. For each job Get the average salary which is greater than average
salary of all managers.
20. Get the number of job positions in each department.
21. Get the number of job positions in each department only if there are
at least 2 employees on that position.

22 Find the average salaries of all clerks.


23. List no of employees joined in every month in ascending order.
24 How many employees who are joined in jan or sept month.
25 Which dept having greater than or equal to 3 employees joined in Feb 1981.
26. List depts which has greater than or equal to 3 employees joined in Feb
1981.
27. How many employees who are joined in jan or sept month.
28. List no of employees joined in every month in ascending order.

Conclusion:

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 24


Experiment No. 8

Aim: To implement set operations and advanced SQL queries.

Query & Output:


Consider schema
Emp(empid,ename,salary,city)
Project(pid,pname,loc)
Works_on(pid,eid,hrs)
1. Get emp names of employees working on project C353.
2. Get details of employees working on project C353.

3. Get details of employees working on project operating system.

4. Get details of employees working on both C353 and C354

5. Get employee nos. of employees who do not work on project C453

6. Get employee nos. of employees who work on all projects.

7. Get employee nos. of employees who work on at least all those


projects that employee 107 works on.

8. Get employee nos. who work on at least one project that employee
107 works on.

Consider Emp(empno,ename,sal,comm,mgr,deptno,job,hiredate)

1. List the details of employees whose job is same as scott.


2. List employees of deptno 20 whose jobs are same as deptno 10
3. List employees whose jobs are same as Ford or sal more than scott.
4. Display no of employees in dept 30 who can earn commissions.
5. List name,job,sal of employees in dept 20 who have the same job as
people in sales dept.
6. Find name and hiredate of any employees in same dept as scott
.Exclude scott in output.
7. Display dept details which has employees working in it.
SIES GRADUATE SCHOOL OF TECHNOLOGY Page 25
8. Display employee details with their manager details.
9. Create a view emp_view on emp table.
10.Create a view emp_dept_view which stores the employee details with
their dept details.
11.Delete a record of smith from emp_dept_view
12.Try to insert a record in emp_dept_view.
13.Create a view on emp which includes empno,ename,job,sal and
rename these colummn as eno,name, jtitle,salary.

Conclusion:

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 26


Experiment No. 9

Aim: To implement functions and procedures in SQL.

1. Write a function to display dept name and location by inputting dept no.
Consider schema dept(deptno,dname,loc).
2. Write a function to calculate gross salary of an employee. Consider schema
Emp(empno,ename,sal,comm,deptno,hiredate,job) and insert the empno and gross
salary in Gross_emp table.
3. Write a function to concate and convert a text into upper or lower case by
checking the flag value. If flag is true the concate and convert the text into
uppercase otherwise in lowercase. A function accepts 3 arguments. Twp arguments
of type text and one is 27ibonac with default value false and returns a text value.

4. Write a 27ibonacci to print 27ibonacci series, Pass no of terms as argument.


5. Write a procedure to display employee name and their salary.

Sample Example:
1. Concating
create or replace function concat_lower_or_upper(a text, b text, uppercase
boolean default false)
returns text
as
$$
declare mytext text;
begin
if ($3 = true) then select into mytext upper($1 || ' ' || $2);
else
select into mytext lower($1 || ' ' || $2);
end if;
return mytext;
end;
$$
language 'plpgsql'
select concat_lower_or_upper('Hello','world',true);
select concat_lower_or_upper('Hello','world',false);
select concat_lower_or_upper('Hello','world');

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 27


2. To call a procedure in a block of code to print the employee name
and salary
create or replace procedure details12(IN p_eno int, inout pename varchar, inout
psal int)
language plpgsql
as $$
begin
select ename, sal into penAME, PSAL from empnew where empno = p_eno;
commit;
end; $$
/*block of code*/
do
$$
declare pename1 varchar;
declare psal1 integer;
begin
call details12(7566,pename1,psal1);
raise notice '%', pename1;
raise notice '%', psal1; /*for salary*/
end
$$

Conclusion:

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 28


Experiment No. 10

Aim: To implement Trigger and views.

Query & Output:


Views:
1. Create a view emp_view on emp table.
2. Create a view v1 on emp table for columns empno,ename,sal,job.
3. Insert a record,delete a record and update a record using view v1.
4. Create a view v2 on emp for deptno 10 and 20.
5. Create a view v3 on emp table for columns empno,ename,sal,job and
rename the column in view as eno,name,salary,jtitle.
6. Create a view emp_dept having columns
empno,ename,deptno,dname,loc from emp and dept.
7. Create a view v4 on emp for deptno 10 and insertion of deptno 10
rows only.Hint: Use check option.
Triggers
1. Write a trigger to maintain log of deleted records. Record the user
who deleted record,time of deleteion and date of transaction.
2. Write a trigger to keep track of all DML transactions on salary of emp
table and maintain the traces in separate table.

Conclusion:

SIES GRADUATE SCHOOL OF TECHNOLOGY Page 29


SIES GRADUATE SCHOOL OF TECHNOLOGY Page 30

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy