0% found this document useful (0 votes)
58 views4 pages

Database Coding Challenges in Python

Interview

Uploaded by

anilmn98
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)
58 views4 pages

Database Coding Challenges in Python

Interview

Uploaded by

anilmn98
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

DATABASE

Database Coding Challenges


Task 50

Database Joins Challenge.

Php Coding Challenge


[Link]

Table Name : Employee

FIRST_NAME LAST_NAME SALARY JOINING_DATE DEPARTMENT

John Abraham 1000000 2013-01-01 Banking


Michael Clarke 800000 2013-01-01 Insurance
Roy Thomas 700000 2013-02-01 Banking
Tom Jose 600000 2013-02-01 Insurance
Jerry Pinto 650000 2013-02-01 Insurance
Philip Mathew 750000 2013-01-01 Services
Towino Thomas 650000 2013-01-01 Services
Leffin Jose 600000 2013-02-01 Insurance

Table Name : Incentives

EMPLOYEE_REF_ID INCENTIVE_DATE INCENTIVE_AMOUNT

1 2013-01-01 5000
2 2013-01-01 3000
3 2013-02-01 4000
4 2013-02-01 4500
5 2013-02-01 4500
6 2013-01-01 3500

Python - Coding Challenge 01


DATABASE
Database Coding Challenges

1. Get all employee details from the employee table.


2. Get First_Name,Last_Name from employee table.
3. Get First_Name from employee table in upper case.
4. Get First_Name from employee table in lower case.
5. Get unique DEPARTMENT from employee table.
6. Select first 3 characters of FIRST_NAME from EMPLOYEE.
7. Get position of 'o' in name 'John' from employee table.
8. Get FIRST_NAME from employee table after removing white spaces from right
side.
9. Get FIRST_NAME from employee table after removing white spaces from left side.
10. Get length of FIRST_NAME from employee table.
11. Get First_Name from employee table after replacing 'o' with '$'.
12. Get First_Name and Last_Name as single column from employee table separated
by a '_'.
13. Get FIRST_NAME, Joining year, Joining Month and Joining Date from employee table.
14. Get all employee details from the employee table order by First_Name Ascending.
15. Get all employee details from the employee table order by First_Name descending.
16. Get all employee details from the employee table order by Salary descending.
17. Get employee details from employee table whose employee name is “John”.
18. Get employee details from employee table whose employee name are “John” and
“Roy”.
19. Get employee details from employee table whose employee name are not “John”
and “Roy”.

[Link] employee details from employee table whose first name ends with 'n' and
name contains 4 letters.
21. Get employee details from employee table whose first name starts with 'J' and
name contains 4 letters.
22. Get employee details from employee table whose Salary greater than 600000.

Python - Coding Challenge 02


DATABASE
Database Coding Challenges

23. Get employee details from employee table whose Salary less than 800000.
24. Get employee details from employee table whose Salary between 500000 and
800000.
25. Get employee details from employee table whose name is 'John' and 'Michael'.
26. Get employee details from employee table whose joining year is “2013”.
27. Get employee details from employee table whose joining month is “January”.
28. Get employee details from employee table who joined before January 1st 2013.
29. Get employee details from employee table after add new column name “Time”.
30. Get Joining Date and Time from employee table.
31. Get Joining Date,Time including milliseconds from employee table.
32. Get difference between JOINING_DATE and INCENTIVE_DATE from employee
and incentives table.
33. Get names of employees from employee table who has '%n' in
Last_Name. Tip : Escape character for special characters in a query.
34. Get Last Name from employee table after replacing special character with white
space.
35. Get department wise average salary from employee table order by salary ascending.
36. Get department wise maximum salary from employee table order by salary
ascending.
37. Get department wise minimum salary from employee table order by salary
ascending.
38. Select no of employees joined with respect to year and month from employee
table.
39. Select department,total salary with respect to a department from employee table
where total salary greater than 800000 order by Total_Salary descending.
40. Select first_name, incentive amount from employee and incentives table for those
employees who have incentives.
41. Select first_name, incentive amount from employee and incentives table for those
employees who have incentives and incentive amount greater than 3000.

Python - Coding Challenge 03


DATABASE
Database Coding Challenges

42. Select first_name, incentive amount from employee and incentives table for all
employes even if they didn't get incentives.
43. Select first_name, incentive amount from employee and incentives table for all
employees even if they didn't get incentives and set incentive amount as 0 for
those employees who didn't get incentives.
44. Select first_name, incentive amount from employee and incentives table for all
employees who got incentives using left join.
45. Select max incentive with respect to employee from employee and incentives
table using sub query.
46. Select TOP 2 salary from employee table.
47. Select 2nd Highest salary from employee table.
48. Select First_Name, LAST_NAME from employee table as separate rows.
49. Select employee details from employee table if data exists in incentive table ?
50. Select 20 % of salary from John , 10% of Salary for Roy and for other 15 % of salary
from employee table.
51. Select Banking as 'Bank Dept', Insurance as 'Insurance Dept' and Services as
'Services Dept' from employee table.
52. Update IncentiveAmount to 9000 in incentive table where employee First Name is
John in Employee table?
53. Delete employee data from employee table who got incentives in incentive table.

Python - Coding Challenge 04

You might also like