Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
30 views
4 pages
DBMS Lab Assignment 6
Uploaded by
Sagar Singh
AI-enhanced title
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
Download
Save
Save DBMS LAB ASSIGNMENT 6 For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
30 views
4 pages
DBMS Lab Assignment 6
Uploaded by
Sagar Singh
AI-enhanced title
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
Carousel Previous
Carousel Next
Download
Save
Save DBMS LAB ASSIGNMENT 6 For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save DBMS LAB ASSIGNMENT 6 For Later
You are on page 1
/ 4
Search
Fullscreen
1.
Create an Employee table with the following attributes:
EmployeeID – Primary Key
FirstName – Not Null Constraint
LastName – Not Null Constraint
Gender – Check Constraint Values (‘M’, ‘F’)
BirthDate – Not Null Constraint
HireDate – Not Null Constraint
Salary – Check Constraint (Salary >0)
Email – Unique and Not null constraint
PhoneNumber – Not NUll
Department – Check Constraint ('HR', 'IT', 'Finance', 'Sales',
'Marketing')
ManagerID – Self referencing Foreign Key
IsFullTime – Boolean Data type (Default value is True)
CREATE TABLE Employee
(EmployeeID INT PRIMARY KEY,
FirstName VARCHAR(50) NOT NULL,
LastName VARCHAR(50) NOT NULL,
Gender CHAR(1) CHECK (Gender IN ('M', 'F')),
BirthDate DATE NOT NULL,
HireDate DATE NOT NULL,
Salary DECIMAL(10, 2) CHECK (Salary > 0),
Email VARCHAR(100) UNIQUE NOT NULL,
PhoneNumber Numeric(15) Not NUll,
Department VARCHAR(50) CHECK (Department IN ('HR', 'IT', 'Finance',
'Sales', 'Marketing')),
ManagerID INT,
IsFullTime BOOLEAN DEFAULT TRUE,
FOREIGN KEY (ManagerID) REFERENCES Employee(EmployeeID));
2. Insert 15 rows into the Employee table
INSERT INTO Employee (EmployeeID, FirstName, LastName, Gender,
BirthDate, HireDate, Salary, Email, PhoneNumber, Department, ManagerID,
IsFullTime) VALUES
(1, 'Alice', 'Smith', 'F', '1990-01-15', '2020-02-20', 60000.00,
'
[email protected]
', '1234567890', 'HR', NULL, TRUE),
(2, 'Bob', 'Johnson', 'M', '1985-05-25', '2019-03-10', 70000.00,
'
[email protected]
', '1234567891', 'IT', 1, TRUE),
(3, 'Carol', 'Williams', 'F', '1992-07-30', '2021-08-15', 55000.00,
'
[email protected]
', '1234567892', 'Finance', 1, TRUE),
(4, 'David', 'Brown', 'M', '1988-12-05', '2018-01-25', 80000.00,
'
[email protected]
', '1234567893', 'Sales', 2, TRUE),
(5, 'Eve', 'Jones', 'F', '1995-03-14', '2022-06-30', 45000.00,
'
[email protected]
', '1234567894', 'Marketing', 3, TRUE),
(6, 'Frank', 'Garcia', 'M', '1987-04-18', '2020-11-01', 62000.00,
'
[email protected]
', '1234567895', 'IT', 2, TRUE),
(7, 'Grace', 'Martinez', 'F', '1993-10-09', '2021-05-17', 48000.00,
'
[email protected]
', '1234567896', 'Finance', 3, TRUE),
(8, 'Henry', 'Hernandez', 'M', '1980-09-21', '2017-04-12', 75000.00,
'
[email protected]
', '1234567897', 'Sales', 4, TRUE),
(9, 'Ivy', 'Lopez', 'F', '1994-02-11', '2022-09-05', 52000.00,
'
[email protected]
', '1234567898', 'Marketing', 5, TRUE),
(10, 'Jack', 'Wilson', 'M', '1986-06-16', '2019-12-22', 72000.00,
'
[email protected]
', '1234567899', 'HR', 1, TRUE),
(11, 'Karen', 'Anderson', 'F', '1991-08-30', '2021-03-08', 61000.00,
'
[email protected]
', '1234567800', 'IT', 2, TRUE),
(12, 'Larry', 'Thomas', 'M', '1984-11-03', '2018-07-19', 82000.00,
'
[email protected]
', '1234567801', 'Finance', 3, TRUE),
(13, 'Megan', 'Taylor', 'F', '1990-03-29', '2020-10-29', 53000.00,
'
[email protected]
', '1234567802', 'Sales', 4, TRUE),
(14, 'Nina', 'Moore', 'F', '1996-05-12', '2022-02-17', 49000.00,
'
[email protected]
', '1234567803', 'Marketing', 5, TRUE),
(15, 'Oscar', 'Jackson', 'M', '1989-07-07', '2018-11-11', 74000.00,
'
[email protected]
', '1234567804', 'HR', 10, TRUE);
3. Count the number of Employees in each department.
SELECT Department, COUNT(*) AS EmployeeCount FROM Employee GROUP
BY Department HAVING COUNT(*) > 1;
4. Display the Average salary based on gender if average
salary is greater than 50000.
SELECT Gender, AVG(Salary) AS AverageSalary FROM Employee GROUP BY
Gender HAVING AVG(Salary) > 50000;
5. Display the total salary expenditure for each department.
SELECT Department, SUM(Salary) AS TotalSalary FROM Employee GROUP BY Department HAVING
SUM(Salary) > 100000;
6. Display the department where maximum salary is less than
80000.
SELECT Department, MAX(Salary) AS MaxSalary FROM Employee GROUP
BY Department HAVING MAX(Salary) < 80000;
7. Display the department details where the number of
employee is greater than 2 and all employees are full time
employee.
SELECT Department, COUNT(*) AS FullTimeCount FROM Employee
WHERE IsFullTime = TRUE GROUP BY Department HAVING COUNT(*) > 2;
8. Find Employees Who Have a Phone Number That Starts with
'123'
SELECT EmployeeID, FirstName, LastName, PhoneNumber FROM Employee
WHERE PhoneNumber LIKE '123%';
9. Add a Bonus to Each Employee's Salary (10% increase).
SELECT EmployeeID, FirstName, LastName, Salary, Salary * 1.10 AS
SalaryWithBonus FROM Employee;
10. Convert Employee First Name to Uppercase
SELECT EmployeeID, UPPER(FirstName) AS FirstName_Upper, LastName
FROM Employee;
11. Get the Length of Each Employee's Full Name (FirstName +
LastName)
SELECT EmployeeID, FirstName, LastName, LENGTH(FirstName) +
LENGTH(LastName) AS FullNameLength FROM Employee;
12. Round the Salaries to the Nearest Thousand
SELECT EmployeeID, FirstName, LastName, Salary, ROUND(Salary, -3) AS
RoundedSalary FROM Employee;
You might also like
Allison 3000-4000 Series Troubleshooting
PDF
94% (131)
Allison 3000-4000 Series Troubleshooting
861 pages
Maths Clinic Gr12 ENG SmartPrep v1.0 1 PDF
PDF
50% (8)
Maths Clinic Gr12 ENG SmartPrep v1.0 1 PDF
69 pages
Pay Matters: The Art and Science of Employee Compensation
From Everand
Pay Matters: The Art and Science of Employee Compensation
David Weaver
5/5 (1)
20 SQL Exercises For Practice: Table Structure and Schema
PDF
100% (5)
20 SQL Exercises For Practice: Table Structure and Schema
12 pages
SQL Queries: 200+ Queries to Challenge you.
From Everand
SQL Queries: 200+ Queries to Challenge you.
Swaroop Kallakuri
5/5 (2)
Big-Ip Dns (Previously GTM) : F5 Partner Technical Boot Camp
PDF
No ratings yet
Big-Ip Dns (Previously GTM) : F5 Partner Technical Boot Camp
45 pages
Mircoproject Queries
PDF
No ratings yet
Mircoproject Queries
9 pages
Mysql Practice
PDF
No ratings yet
Mysql Practice
10 pages
Lab Answers
PDF
No ratings yet
Lab Answers
21 pages
Database Programming Evaluation Practical
PDF
No ratings yet
Database Programming Evaluation Practical
10 pages
3rd Company
PDF
No ratings yet
3rd Company
2 pages
RDBMS1
PDF
No ratings yet
RDBMS1
7 pages
Lab Objectives
PDF
No ratings yet
Lab Objectives
6 pages
Assignment 3 - Shouvik (1159)
PDF
No ratings yet
Assignment 3 - Shouvik (1159)
15 pages
Untitled Document
PDF
No ratings yet
Untitled Document
5 pages
SQL Exercises and Solutions in MySQL
PDF
No ratings yet
SQL Exercises and Solutions in MySQL
12 pages
SQL Exercises and Solutions in MySQL Practice
PDF
No ratings yet
SQL Exercises and Solutions in MySQL Practice
10 pages
SQL 3
PDF
0% (1)
SQL 3
7 pages
DBMS Record Lab Manual
PDF
100% (1)
DBMS Record Lab Manual
23 pages
DBMS All PR
PDF
No ratings yet
DBMS All PR
13 pages
Additional SQL Queries For Practice
PDF
No ratings yet
Additional SQL Queries For Practice
6 pages
SCHEMA1
PDF
No ratings yet
SCHEMA1
19 pages
Abhay 51048 Dbms Ass 04
PDF
No ratings yet
Abhay 51048 Dbms Ass 04
8 pages
SQL New Assignment 2
PDF
No ratings yet
SQL New Assignment 2
5 pages
Mysql Practical File Assignment
PDF
No ratings yet
Mysql Practical File Assignment
6 pages
Dbms Lab1
PDF
No ratings yet
Dbms Lab1
14 pages
Source Code Dbms
PDF
No ratings yet
Source Code Dbms
14 pages
MST - Database Management System Lab Worksheet - 1
PDF
No ratings yet
MST - Database Management System Lab Worksheet - 1
4 pages
Lab 2&3
PDF
No ratings yet
Lab 2&3
3 pages
SQL A
PDF
No ratings yet
SQL A
5 pages
How Many Different Departments Are There in The Employee' Table. A)
PDF
No ratings yet
How Many Different Departments Are There in The Employee' Table. A)
14 pages
18bit0166 Ayush Kanaujia
PDF
No ratings yet
18bit0166 Ayush Kanaujia
12 pages
Tabele Do Ćwiczeń
PDF
No ratings yet
Tabele Do Ćwiczeń
4 pages
21bce0968 VL2023240100969 Ast02
PDF
No ratings yet
21bce0968 VL2023240100969 Ast02
20 pages
Institute of Technology, Nirma University Semester III Course Code & Name: Report On Topic: Prepared & Submitted by
PDF
No ratings yet
Institute of Technology, Nirma University Semester III Course Code & Name: Report On Topic: Prepared & Submitted by
12 pages
Assignment-1 Dbms
PDF
No ratings yet
Assignment-1 Dbms
3 pages
Case When Coding Snippet
PDF
No ratings yet
Case When Coding Snippet
20 pages
Name: Siva 19BCE1582 Ex. 2 DML
PDF
No ratings yet
Name: Siva 19BCE1582 Ex. 2 DML
6 pages
18apr2025 Nasim
PDF
No ratings yet
18apr2025 Nasim
4 pages
Challenge Transactions
PDF
No ratings yet
Challenge Transactions
2 pages
Dac DBT SQL Exercises and Solutions Assignments III IV V
PDF
100% (2)
Dac DBT SQL Exercises and Solutions Assignments III IV V
10 pages
DBMS Lab Practical 1
PDF
No ratings yet
DBMS Lab Practical 1
4 pages
Name: Roll # Class ID: 103752
PDF
No ratings yet
Name: Roll # Class ID: 103752
5 pages
Sanjar Xolmirzayev - SQL Practice Worksheet (Employee Database)
PDF
No ratings yet
Sanjar Xolmirzayev - SQL Practice Worksheet (Employee Database)
9 pages
HMT 3072 SQL PDF
PDF
No ratings yet
HMT 3072 SQL PDF
58 pages
SQL HR Case Study
PDF
No ratings yet
SQL HR Case Study
6 pages
DBMS 5Q
PDF
No ratings yet
DBMS 5Q
10 pages
Practice Questions
PDF
No ratings yet
Practice Questions
8 pages
Tables For Practice
PDF
No ratings yet
Tables For Practice
5 pages
Cep 1 Employee Performance Mapping Problem Statment
PDF
No ratings yet
Cep 1 Employee Performance Mapping Problem Statment
10 pages
HR Schema
PDF
No ratings yet
HR Schema
18 pages
SQL Interview Questions Top 100
PDF
No ratings yet
SQL Interview Questions Top 100
18 pages
DBMS Practical
PDF
No ratings yet
DBMS Practical
6 pages
Dbms Assin 1
PDF
No ratings yet
Dbms Assin 1
29 pages
Daily Practice Questions
PDF
No ratings yet
Daily Practice Questions
2 pages
LiveSQL 1
PDF
No ratings yet
LiveSQL 1
2 pages
Lab 3 - Aliases TO Truncate
PDF
No ratings yet
Lab 3 - Aliases TO Truncate
9 pages
Project
PDF
No ratings yet
Project
16 pages
Empnum Empname Dept - Id: 'Yet To Assigned'
PDF
No ratings yet
Empnum Empname Dept - Id: 'Yet To Assigned'
3 pages
Exercise 1
PDF
No ratings yet
Exercise 1
2 pages
DBMS Lab
PDF
No ratings yet
DBMS Lab
15 pages
Lab 3
PDF
No ratings yet
Lab 3
2 pages
Let's Play with Excel
From Everand
Let's Play with Excel
Anurag Pandey
No ratings yet
Dac 2
PDF
No ratings yet
Dac 2
2 pages
Must Upload at Least One Useful Note PDF (Not Among The Top 50 Common Ones) Access or Search Others' Notes
PDF
No ratings yet
Must Upload at Least One Useful Note PDF (Not Among The Top 50 Common Ones) Access or Search Others' Notes
3 pages
Phishing - Extension - PPT
PDF
No ratings yet
Phishing - Extension - PPT
6 pages
Ab 5
PDF
No ratings yet
Ab 5
5 pages
West Sample Question
PDF
100% (1)
West Sample Question
5 pages
Order PDF
PDF
No ratings yet
Order PDF
1 page
BioBlocksLab - A Portable DIY Bio Lab Using BioBlocks Language - ScienceDirect
PDF
No ratings yet
BioBlocksLab - A Portable DIY Bio Lab Using BioBlocks Language - ScienceDirect
14 pages
BAED-AI2121-2322S-Written Work 2 4th Quarter Grade 12
PDF
100% (1)
BAED-AI2121-2322S-Written Work 2 4th Quarter Grade 12
5 pages
Introduction To CMOS RF Integrated Circuits Design: V. Voltage Controlled Oscillators
PDF
No ratings yet
Introduction To CMOS RF Integrated Circuits Design: V. Voltage Controlled Oscillators
46 pages
ELECTRONICS COURSE Fundamentals Revised
PDF
No ratings yet
ELECTRONICS COURSE Fundamentals Revised
75 pages
Stepper Motors Catalog
PDF
100% (1)
Stepper Motors Catalog
35 pages
Automatic Threat Detection in Single-Dual and Multi-View XRay Images
PDF
No ratings yet
Automatic Threat Detection in Single-Dual and Multi-View XRay Images
12 pages
Test Plan Template 20
PDF
No ratings yet
Test Plan Template 20
15 pages
12 Chapterwise Blue Print 2022-23
PDF
No ratings yet
12 Chapterwise Blue Print 2022-23
3 pages
Chapter-1. Introduction To Communication Systems:-: (April-2010) (07) (2.1 & 2.2)
PDF
No ratings yet
Chapter-1. Introduction To Communication Systems:-: (April-2010) (07) (2.1 & 2.2)
6 pages
OrangePi 5 Plus RK3588 User-Manual v1.5.1
PDF
100% (1)
OrangePi 5 Plus RK3588 User-Manual v1.5.1
531 pages
Citrix MetaFrame Web Interface Administrator's Guide
PDF
No ratings yet
Citrix MetaFrame Web Interface Administrator's Guide
141 pages
2018 THSF mt8173 PCM
PDF
No ratings yet
2018 THSF mt8173 PCM
95 pages
Refund BSP
PDF
No ratings yet
Refund BSP
17 pages
Budget of Work - Ict Grade 10
PDF
No ratings yet
Budget of Work - Ict Grade 10
9 pages
CL24V Con CB
PDF
No ratings yet
CL24V Con CB
2 pages
TCS Digital - Sample Questions For Colleges
PDF
No ratings yet
TCS Digital - Sample Questions For Colleges
9 pages
Product Development Life Cycle
PDF
No ratings yet
Product Development Life Cycle
1 page
Pptmicro
PDF
No ratings yet
Pptmicro
9 pages
Dingo Coin White Paper
PDF
No ratings yet
Dingo Coin White Paper
4 pages
Functionality Doc Fleet Management App Version1
PDF
No ratings yet
Functionality Doc Fleet Management App Version1
15 pages
Sensors: Indoor Positioning Algorithm Based On The Improved RSSI Distance Model
PDF
No ratings yet
Sensors: Indoor Positioning Algorithm Based On The Improved RSSI Distance Model
15 pages
N3cs19 Practice Set 17: Iple Pages. If Your Current Grade Pct. Is 82%, You May Complete Between 2 of The 3 Sections
PDF
No ratings yet
N3cs19 Practice Set 17: Iple Pages. If Your Current Grade Pct. Is 82%, You May Complete Between 2 of The 3 Sections
1 page
010022e Dat Microrep GB
PDF
No ratings yet
010022e Dat Microrep GB
6 pages
MoA AoA Amended PDF
PDF
No ratings yet
MoA AoA Amended PDF
185 pages
Meta Search Engine Using Distributed Information Retrieval
PDF
No ratings yet
Meta Search Engine Using Distributed Information Retrieval
35 pages
Governance, Risk and Compliance - Energy Industry
PDF
100% (2)
Governance, Risk and Compliance - Energy Industry
4 pages