0% found this document useful (0 votes)
41 views8 pages

DBMS Practicals For Practical File

The document contains instructions to create an "Employee" database with "Emp_details" and "Dept" tables, insert sample data, and perform various SQL queries on the tables including adding/updating fields, sorting, filtering, aggregating, and joining data between the tables. Queries cover concepts like primary keys, WHERE clauses, ORDER BY, aggregation functions, JOINs, and DML commands like UPDATE, DELETE, and INSERT.

Uploaded by

pidogit842
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)
41 views8 pages

DBMS Practicals For Practical File

The document contains instructions to create an "Employee" database with "Emp_details" and "Dept" tables, insert sample data, and perform various SQL queries on the tables including adding/updating fields, sorting, filtering, aggregating, and joining data between the tables. Queries cover concepts like primary keys, WHERE clauses, ORDER BY, aggregation functions, JOINs, and DML commands like UPDATE, DELETE, and INSERT.

Uploaded by

pidogit842
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/ 8

Q1)Write queries to create an “Employee” Database and “Emp_details” table with the following fields:

Emp_id | Name | Address | Age | DOB | Mobile


Create another table “Dept” with the following structure:
Empid | Dept_name | Salary | Dept_id

2. Write queries to insert 10 records into both the tables.

Emp_details:-
Dept:-

3.Implement the following SQL commands on ‘Emp_details’ and ‘Dept’ tables and show the output:
A) Add a new attribute “Gender” to the Emp_details table.

B)Add primary key constraint on the column “Emp_id”.

C)UPDATE the age to 27 for the Employee named “Emily Davis” in “Emp_details” table.
D)Display the details of all the employees in decreasing order of their age from table “emp_details”.

E)Delete the records of those employees whose age is more than 60 from the table “emp_details”.

F)Display the department name and count of employees in each department from the table “Dept”.
G)Write SQL query to display the average salary of Employees.

H)Display the name and age of those employees whose age is more than 25 and surname is “Kumar” from the
table “emp_details”.

I)Calculate and show the average salary of departments -Finance and HR. from the table “Dept”.

J)Write SQL query to display the total number of male Employees in the table.
K)Display the unique departments from the table “Dept”.

L)Display the Name, Address and salaries of the employees who are staying in ‘Vaishali’.

M)Display the employee id, name and salary of all the employees whose department id is either ‘D2’ or ‘D3’.
N)Display the maximum salary in each department.

O)Display all the records of table “Emp_Details” in decreasing order of age.


P)Display the Cartesian product of the tables ‘Emp_Details and Dept’.

Q)Increment the salary of all employees by 1000 in the table “Dept”.

R)Display emp_id, employee name and department name of all employees whose age is more than 20.
S)Display the average salary of each department.

You might also like