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

DBMS LAB FILE

file on dbms

Uploaded by

sherrysingh.246
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

DBMS LAB FILE

file on dbms

Uploaded by

sherrysingh.246
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 43

LAB FILE

OF
DATABASE MANAGEMENT SYSTEM
PCC-CSE-504
B.TECH CSE 5th SEM

SUBMITTED TO:- SUBMITTED BY:-


DR. STUTI SAXENA NAME:
Associate Professor ROLL NO:-

Department of Computer Science and Engineering


S.NO TITLE DATE S.DATE SIGN
1 To create table using 02-09-2024 16-09-2024
MySQL.
2 To perform DML 16-09-2024 23-09-2024
operations in MYSQL.
3 To perform queries 23-09-2024 30-09-2024
using DML in MySQL.
4 To Perform SELECT 30-09-2024 07-09-2024
WHERE operation .
5 Perform AGGEREGATE 07-10-2024 14-10-2024
function in MySQL.

6 To perform LIKE 14-10-2024 25-10-2024


function in MySQL.
7 To perform aggregate 25-10-2024 01-11-2024
function in MySQL.
8 To perform queries 01-11-2024 07-11-2024
on multiple table.
9 To perform ALTER 07-11-2024 07-11-2024
function in Mysql.

INDEX

PRACTICAL-1
Department of Computer Science and Engineering
AIM:-
To create table using MySQL.
QUERIES:-
(1) Create table according to following schemas
(a) Sailors(sid, sname,rating,age)
(b) Boat(bid, bname, color)
(c) Reserve(sid, bid, day)
(2) Show all table respectively.
(3) Describe the structure of the table.

Syntax:-
CREATE TABLE table_name(
Column1 datatype,
Column2 datatype,
Column3 datatype,
………………
………………..
)

Department of Computer Science and Engineering


Department of Computer Science and Engineering
Department of Computer Science and Engineering
Practical-2
Aim:-
To perform DML operations in MySQL.
QUERIES:-
(1) Insert 10 rows in each table
Syntax:-
INSERT INTO table_name(column1,
column2,column3…)
VALUES(value1, value2, value3,…)

Output:-

Department of Computer Science and Engineering


Department of Computer Science and Engineering
Department of Computer Science and Engineering
Practical-3
AIM:-
To perform the quries using DML in MySQL.

QUERIES:-
(1) Find out all the tupples present in sailor table.
(2) Find out all the tupples present in boat table.
(3) Find out all the tupples present in reserves table.
SYNTAX:-
SELECT*FROM table_name;
OUTPUT:-

Department of Computer Science and Engineering


Department of Computer Science and Engineering
PRACTICL-4
AIM:-
To perform SELECT and WHERE operations in MySQL.
QUERIES:-
(1) Find out the rating from the sailor table.
(2) Find out the bid from table boat.
(3) Find out the sid when boat reserve on Monday.
(4) Find out the bname having color red.
(5) Find out the sname who are eligible for voting.
(6) Find out the bid where the bname is A.
(7) Find out the sname where rating is greater than 8.
(8) Find out the unique Sid.
(9) Find out the all bid when the boat reserve on Monday.
(10) Find out the bid where boat color id red or green.

OUTPUT:-

Department of Computer Science and Engineering


Department of Computer Science and Engineering
Department of Computer Science and Engineering
Department of Computer Science and Engineering
Department of Computer Science and Engineering
Department of Computer Science and Engineering
Department of Computer Science and Engineering
PRACTICAL-5
AIM:-
To perform AGGREGATE function in MySQL.

QUERIES:-
(1) Find out maximum rating in sailor.
(2) Find out the total number of boats.
(3) Find out the number of unique Sid.
(4) Find out the minimum rating from sailors.
(5) Find out the smallest sailor.

SYNTAX:-
(1) SELECT MAX(column1),max(column2),…
FROM table_name;
(2) SELECT SUM(column1),max(column2),…
FROM table_name
WHERE condition;
(3) SELECT COUNT(DISTINCT column1),……
FROM table_name
WHERE condition;
(4) SELECT MIN(column1),…….
FROM table_name
WHERE condition;

Department of Computer Science and Engineering


OUTPUT:-

Department of Computer Science and Engineering


Department of Computer Science and Engineering
PRATICAL-6
AIM:-
To perform LIKE function in MySQL.
QUERIES:-
(1) Find out the sailor name which starts with ‘A’.
(2) Find out the sailor name which end with ‘I’.
(3) Find out the boat name where the second
character of a boat name is ‘A’.
(4) Find out the name of sailor having exactly 1 letters
in the name
(5) Find out the sailor name where the middle letter is
I’.
SYNTAX:-
SELECT column1, column2,……
FROM table_name
WHERE column LIKE pattern;

OUTPUT:-

Department of Computer Science and Engineering


Department of Computer Science and Engineering
Department of Computer Science and Engineering
PRATICAL-7
AIM:-
To Perform Aggregate function on MySQL.

QUERIES:-
Create table according to given schema-
a) Dept(deptno, dname, loc);
b) Emp(empno, ename, job,mgr,hiredate,sal,comm,deptno);

(i) Arrange all Employee name in descending order.


(ii) Find out the department name and department number
from department table.
(iii) Find out the details of employees.
(iv) Find out the employee name, number and job where the
department number is 20.
(v) Find out the department number and the name for all the
departments with department
number>=20.
(vi) Find out the job from employee table.

Department of Computer Science and Engineering


(vii) Find out the number of employees who have job title
means where the job is not null
(isnull ).
(viii) Find out the total salary of employees department vice
(groupby).
(ix) Find out the job- vice salary, average salary, minimum salary
and maximum salary .
(x) Find out the maximum and minimum salary of employees .
(xi) Find out the employee name and the salary of all the
employees in the department
number 30 in ascending order of their salaries .
(xii) Find out the employee name, salary, and job for all the
employees from department 20
and salary and employee name are in descending order.

SYNTAX:-
1. COUNT
SELECT COUNT(*) FROM table_name
WHERE condition;
SELECT column1, column2,…
FROM table_name

Department of Computer Science and Engineering


WHERE condition;
2. SUM
SELECT SUM(column1), SUM(column2),….
FROM table_name
WHERE condition;
3. AVG
SELECT AVG(column)
FROM table_name;
4. MAX
SELECT MAX(column)
FROM table_name;
5. MIN
SELECT MIN(column)
FROM table_name;

Output:-

Department of Computer Science and Engineering


Department of Computer Science and Engineering
Department of Computer Science and Engineering
Department of Computer Science and Engineering
Department of Computer Science and Engineering
Department of Computer Science and Engineering
Department of Computer Science and Engineering
Department of Computer Science and Engineering
Department of Computer Science and Engineering
Department of Computer Science and Engineering
Department of Computer Science and Engineering
Department of Computer Science and Engineering
PRACTICAL – 8
AIM:-
To Perform Queries for multiple table using MySQL.

QUERIES:-
(i) Find out the name of the sailor who reserves a red Boat but
not green.
(ii) Find out all Sid of sailors who reserve a red or green boat.
(iii) Find out the sailor name who reserves a red Boat.
(iv) Find out the sailor name who reserves a boat on Monday.
(v) Find out the colour of boat reserved by Lubar (sailor name).
(vi) Find out the age of the sailor whose name begins with 'b'
and end with 'b' and has at
least 3 characters.
(vii) Find out the Sid of sailor who have rating of 10 or reserve a
boat 104 (Bid).

SYNTAX:-
SELECT table1name.column1name, table2name.column2name
FROM table1name, table2name

Department of Computer Science and Engineering


WHERE table1name.column1name =
table2name.column1name;

OUTPUT:-

Department of Computer Science and Engineering


PRACTICAL – 9
AIM:-
To perform ALTER function on MySQL.

QUERIES:-
(i) Change the job of the employee 'Miller' to Manager.
(ii) Delete the detail of John from employee table.
(iii) Drop the primary key from the employee table.
(iv) Drop the employee table.
(v) Raise the Salary by 10 % and a new column of 15 % of the
Salary for emp from
department 30, who are not eligible for column at present.
(vi) Give the increment of 500 to the manager in the company.
(vii) Disable the primary key in department table.

SYTAX:-
UPDATE table_name
SET column_name1 = Value, Column_name2 = Value
WHERE condition;
ALTER TABLE table_name

Department of Computer Science and Engineering


ADD PRIMARY KEY (column_name);
ALTER TABLE table_name
DROP PRIMARY KEY;
DROP TABLE table_name;

OUTPUT:-

Department of Computer Science and Engineering


Department of Computer Science and Engineering
Department of Computer Science and Engineering

You might also like