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

Tech Ops Assignment

Uploaded by

Ashish Eradi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Tech Ops Assignment

Uploaded by

Ashish Eradi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

SECTION - 1

You are managing a comprehensive employee database that comprises the "EmployeeDetails"
table, which includes employee records with various details like EmployeeID, FirstName,
LastName, Salary, JoiningDate, DepartmentID. Additionally, the database incorporates a
"Departments" table, containing information about the various departments within the company,
identified by DepartmentID and labeled with DepartmentName.

EmployeeID FirstName LastName Salary JoiningDate DepartmentID

1 John Doe 75000 2018-05-15 1

2 Jane Smith 80000 2016-02-10 2

3 Bob Johnson 70000 2019-11-20 3

4 Sarah Williams 85000 2017-08-30 4

5 Michael Brown 72000 2020-04-05 5

6 Emily Anderson 78000 2018-12-12 1

7 David Martin 74000 2017-07-25 2

8 Jennifer Wilson 89000 2015-09-18 3

9 William Jones 73000 2020-02-03 4

10 Amanda Davis 79000 2019-01-08 5

11 Matthew Taylor 71000 2016-06-14 1

12 Laura Harris 86000 2018-04-22 2

13 Christopher Clark 72000 2019-05-27 3

14 Rebecca Moore 77000 2017-10-10 4

15 Daniel Walker 91000 2016-03-07 5

16 Linda White 70000 2020-08-12 1

17 Ryan Thomas 75000 2018-09-01 2

18 Jessica Allen 83000 2015-04-17 3

19 James Evans 76000 2019-02-28 4

20 Karen Parker 92000 2016-11-11 5

21 Joseph Scott 71000 2017-03-19 1

22 Megan Turner 80000 2018-07-24 2

23 Andrew King 75000 2019-10-05 3

24 Susan Baker 87000 2017-01-13 4

25 Mark Garcia 73000 2020-01-30 5


DepartmentID DepartmentName

1 Sales

2 Marketing

3 Finance

4 Engineering

5 Human Resources

Your task is to write SQL queries to solve the following scenarios and challenges related to the
employee data:

Scenario 1: A new employee, "Sarah," is joining the company. Write an SQL query to insert a
new record for Sarah into the "EmployeeDetails" table with her details. Make sure to generate a
unique EmployeeID for her.

Scenario 2: The company wants a report of its top earners, showing the EmployeeID,
FirstName, LastName, Salary, and DepartmentName. Write an SQL query to select the details
of the top 5 earners along with their department names.

Scenario 3: HR wants to know how many employees are in each department. Write an SQL
query to select the "DepartmentName" and the count of employees in each department. Use an
inner join between the "EmployeeDetails" and "Departments" tables.

Scenario 4: The company is expanding and is creating a new department named "Research
and Development." Write an SQL query to insert a new department with the appropriate
DepartmentID and DepartmentName into the "Departments" table.

Scenario 5: The company has recently created a new department called "Quality Assurance"
(DepartmentID 6). They want to assign a few employees to this new department. Write an SQL
query to update the "DepartmentID" in the "EmployeeDetails" table for a few employees
(EmployeeID 11, 18, 20, 3) and assign them to the "Quality Assurance" department
(DepartmentID 6).
SECTION - 2

​ 1. A man has Rs.480 in the denominations of one-rupee notes, five-rupee notes and
ten-rupee notes. The number of notes of each denomination is equal. What is the total
number of notes that he has ?
A.45 B.60 C.75 D.90

​ 2. A grocer has a sale of Rs. 6435, Rs. 6927, Rs. 6855, Rs. 7230 and Rs. 6562 for 5
consecutive months. How much sale must he have in the sixth month so that he gets an
average sale of Rs. 6500?
A.Rs. 4991 B.Rs. 5991 C.Rs. 6001 D.Rs. 6991

​ 3. A company's revenue is $500,000, and its expenses are $350,000. Calculate the
company's profit.
​ A) $500,000 B) $350,000 C) $150,000 D) $200,000

SECTION - 3

1. Explain the purpose of if-else statements in programming. How do they enable


decision-making in code? Provide an example scenario where an if-else statement
would be useful.

2. Describe the purpose of a for loop in programming. Provide an example of a situation


where a for loop would be useful and explain how it works.

You might also like