# Database DSA Problems

> 197 Database coding problems for placements and interviews, sorted easiest first, with hints and company tags. Free practice on InternHack.

Canonical: https://www.internhack.in/learn/dsa/database
Last updated: 2026-11-28

197 database problems for coding interviews and campus placements, with hints and company tags. Below are the first 100 of 197: 85 easy, 0 medium and 15 hard. Practise them free on InternHack and track what you have solved.

## Database problems, easiest first

1. [Actors and Directors Who Cooperated At Least Three Times](https://www.internhack.in/learn/dsa/problem/actors-and-directors-who-cooperated-at-least-three-times) (Easy)
2. [Ad-Free Sessions](https://www.internhack.in/learn/dsa/problem/ad-free-sessions) (Easy)
3. [Ads Performance](https://www.internhack.in/learn/dsa/problem/ads-performance) (Easy)
4. [All the Matches of the League](https://www.internhack.in/learn/dsa/problem/all-the-matches-of-the-league) (Easy)
5. [All Valid Triplets That Can Represent a Country](https://www.internhack.in/learn/dsa/problem/all-valid-triplets-that-can-represent-a-country) (Easy)
6. [Article Views I](https://www.internhack.in/learn/dsa/problem/article-views-i) (Easy)
7. [Average Selling Price](https://www.internhack.in/learn/dsa/problem/average-selling-price) (Easy)
8. [Average Time of Process per Machine](https://www.internhack.in/learn/dsa/problem/average-time-of-process-per-machine) (Easy)
9. [Bank Account Summary II](https://www.internhack.in/learn/dsa/problem/bank-account-summary-ii) (Easy)
10. [Big Countries](https://www.internhack.in/learn/dsa/problem/big-countries) (Easy)
11. [Biggest Single Number](https://www.internhack.in/learn/dsa/problem/biggest-single-number) (Easy)
12. [Calculate Compressed Mean](https://www.internhack.in/learn/dsa/problem/calculate-compressed-mean) (Easy)
13. [Calculate Special Bonus](https://www.internhack.in/learn/dsa/problem/calculate-special-bonus) (Easy)
14. [Classes With at Least 5 Students](https://www.internhack.in/learn/dsa/problem/classes-with-at-least-5-students) (Easy)
15. [Classifying Triangles by Lengths](https://www.internhack.in/learn/dsa/problem/classifying-triangles-by-lengths) (Easy)
16. [Combine Two Tables](https://www.internhack.in/learn/dsa/problem/combine-two-tables) (Easy)
17. [Create a Session Bar Chart](https://www.internhack.in/learn/dsa/problem/create-a-session-bar-chart) (Easy)
18. [Customer Order Frequency](https://www.internhack.in/learn/dsa/problem/customer-order-frequency) (Easy)
19. [Customer Placing the Largest Number of Orders](https://www.internhack.in/learn/dsa/problem/customer-placing-the-largest-number-of-orders) (Easy)
20. [Customer Who Visited but Did Not Make Any Transactions](https://www.internhack.in/learn/dsa/problem/customer-who-visited-but-did-not-make-any-transactions) (Easy)
21. [Customers Who Never Order](https://www.internhack.in/learn/dsa/problem/customers-who-never-order) (Easy)
22. [Delete Duplicate Emails](https://www.internhack.in/learn/dsa/problem/delete-duplicate-emails) (Easy)
23. [Duplicate Emails](https://www.internhack.in/learn/dsa/problem/duplicate-emails) (Easy)
24. [Employee Bonus](https://www.internhack.in/learn/dsa/problem/employee-bonus) (Easy)
25. [Employees Earning More Than Their Managers](https://www.internhack.in/learn/dsa/problem/employees-earning-more-than-their-managers) (Easy)
26. [Employees Whose Manager Left the Company](https://www.internhack.in/learn/dsa/problem/employees-whose-manager-left-the-company) (Easy)
27. [Find Books with No Available Copies](https://www.internhack.in/learn/dsa/problem/find-books-with-no-available-copies) (Easy)
28. [Find Candidates for Data Scientist Position](https://www.internhack.in/learn/dsa/problem/find-candidates-for-data-scientist-position) (Easy)
29. [Find Customer Referee](https://www.internhack.in/learn/dsa/problem/find-customer-referee) (Easy)
30. [Find Customers With Positive Revenue this Year](https://www.internhack.in/learn/dsa/problem/find-customers-with-positive-revenue-this-year) (Easy)
31. [Find Expensive Cities](https://www.internhack.in/learn/dsa/problem/find-expensive-cities) (Easy)
32. [Find Followers Count](https://www.internhack.in/learn/dsa/problem/find-followers-count) (Easy)
33. [Find the Team Size](https://www.internhack.in/learn/dsa/problem/find-the-team-size) (Easy)
34. [Find Total Time Spent by Each Employee](https://www.internhack.in/learn/dsa/problem/find-total-time-spent-by-each-employee) (Easy)
35. [Find Users With Valid E-Mails](https://www.internhack.in/learn/dsa/problem/find-users-with-valid-e-mails) (Easy)
36. [Fix Names in a Table](https://www.internhack.in/learn/dsa/problem/fix-names-in-a-table) (Easy)
37. [Friend Requests I: Overall Acceptance Rate](https://www.internhack.in/learn/dsa/problem/friend-requests-i-overall-acceptance-rate) (Easy)
38. [Friendly Movies Streamed Last Month](https://www.internhack.in/learn/dsa/problem/friendly-movies-streamed-last-month) (Easy)
39. [Game Play Analysis I](https://www.internhack.in/learn/dsa/problem/game-play-analysis-i) (Easy)
40. [Game Play Analysis II](https://www.internhack.in/learn/dsa/problem/game-play-analysis-ii) (Easy)
41. [Group Sold Products By The Date](https://www.internhack.in/learn/dsa/problem/group-sold-products-by-the-date) (Easy)
42. [Immediate Food Delivery I](https://www.internhack.in/learn/dsa/problem/immediate-food-delivery-i) (Easy)
43. [Invalid Tweets](https://www.internhack.in/learn/dsa/problem/invalid-tweets) (Easy)
44. [List the Products Ordered in a Period](https://www.internhack.in/learn/dsa/problem/list-the-products-ordered-in-a-period) (Easy)
45. [Loan Types](https://www.internhack.in/learn/dsa/problem/loan-types) (Easy)
46. [Not Boring Movies](https://www.internhack.in/learn/dsa/problem/not-boring-movies) (Easy)
47. [NPV Queries](https://www.internhack.in/learn/dsa/problem/npv-queries) (Easy)
48. [Number of Comments per Post](https://www.internhack.in/learn/dsa/problem/number-of-comments-per-post) (Easy)
49. [Number of Unique Subjects Taught by Each Teacher](https://www.internhack.in/learn/dsa/problem/number-of-unique-subjects-taught-by-each-teacher) (Easy)
50. [Patients With a Condition](https://www.internhack.in/learn/dsa/problem/patients-with-a-condition) (Easy)
51. [Percentage of Users Attended a Contest](https://www.internhack.in/learn/dsa/problem/percentage-of-users-attended-a-contest) (Easy)
52. [Primary Department for Each Employee](https://www.internhack.in/learn/dsa/problem/primary-department-for-each-employee) (Easy)
53. [Product Sales Analysis I](https://www.internhack.in/learn/dsa/problem/product-sales-analysis-i) (Easy)
54. [Product Sales Analysis II](https://www.internhack.in/learn/dsa/problem/product-sales-analysis-ii) (Easy)
55. [Product Sales Analysis V](https://www.internhack.in/learn/dsa/problem/product-sales-analysis-v) (Easy)
56. [Product's Price for Each Store](https://www.internhack.in/learn/dsa/problem/products-price-for-each-store) (Easy)
57. [Project Employees I](https://www.internhack.in/learn/dsa/problem/project-employees-i) (Easy)
58. [Project Employees II](https://www.internhack.in/learn/dsa/problem/project-employees-ii) (Easy)
59. [Queries Quality and Percentage](https://www.internhack.in/learn/dsa/problem/queries-quality-and-percentage) (Easy)
60. [Rearrange Products Table](https://www.internhack.in/learn/dsa/problem/rearrange-products-table) (Easy)
61. [Recyclable and Low Fat Products](https://www.internhack.in/learn/dsa/problem/recyclable-and-low-fat-products) (Easy)
62. [Reformat Department Table](https://www.internhack.in/learn/dsa/problem/reformat-department-table) (Easy)
63. [Replace Employee ID With The Unique Identifier](https://www.internhack.in/learn/dsa/problem/replace-employee-id-with-the-unique-identifier) (Easy)
64. [Reported Posts](https://www.internhack.in/learn/dsa/problem/reported-posts) (Easy)
65. [Rising Temperature](https://www.internhack.in/learn/dsa/problem/rising-temperature) (Easy)
66. [Sales Analysis I](https://www.internhack.in/learn/dsa/problem/sales-analysis-i) (Easy)
67. [Sales Analysis II](https://www.internhack.in/learn/dsa/problem/sales-analysis-ii) (Easy)
68. [Sales Analysis III](https://www.internhack.in/learn/dsa/problem/sales-analysis-iii) (Easy)
69. [Sales Person](https://www.internhack.in/learn/dsa/problem/sales-person) (Easy)
70. [Sellers With No Sales](https://www.internhack.in/learn/dsa/problem/sellers-with-no-sales) (Easy)
71. [Students and Examinations](https://www.internhack.in/learn/dsa/problem/students-and-examinations) (Easy)
72. [Students With Invalid Departments](https://www.internhack.in/learn/dsa/problem/students-with-invalid-departments) (Easy)
73. [Swap Sex of Employees](https://www.internhack.in/learn/dsa/problem/swap-sex-of-employees) (Easy)
74. [The Latest Login in 2020](https://www.internhack.in/learn/dsa/problem/the-latest-login-in-2020) (Easy)
75. [The Number of Employees Which Report to Each Employee](https://www.internhack.in/learn/dsa/problem/the-number-of-employees-which-report-to-each-employee) (Easy)
76. [The Number of Rich Customers](https://www.internhack.in/learn/dsa/problem/the-number-of-rich-customers) (Easy)
77. [The Number of Users That Are Eligible for Discount](https://www.internhack.in/learn/dsa/problem/the-number-of-users-that-are-eligible-for-discount) (Easy)
78. [The Users That Are Eligible for Discount](https://www.internhack.in/learn/dsa/problem/the-users-that-are-eligible-for-discount) (Easy)
79. [The Winner University](https://www.internhack.in/learn/dsa/problem/the-winner-university) (Easy)
80. [Top Travellers](https://www.internhack.in/learn/dsa/problem/top-travellers) (Easy)
81. [Triangle Judgement](https://www.internhack.in/learn/dsa/problem/triangle-judgement) (Easy)
82. [User Activity for the Past 30 Days I](https://www.internhack.in/learn/dsa/problem/user-activity-for-the-past-30-days-i) (Easy)
83. [User Activity for the Past 30 Days II](https://www.internhack.in/learn/dsa/problem/user-activity-for-the-past-30-days-ii) (Easy)
84. [Warehouse Manager](https://www.internhack.in/learn/dsa/problem/warehouse-manager) (Easy)
85. [Weather Type in Each Country](https://www.internhack.in/learn/dsa/problem/weather-type-in-each-country) (Easy)
86. [Analyze Organization Hierarchy](https://www.internhack.in/learn/dsa/problem/analyze-organization-hierarchy) (Hard)
87. [Consecutive Transactions with Increasing Amounts](https://www.internhack.in/learn/dsa/problem/consecutive-transactions-with-increasing-amounts) (Hard)
88. [Customers With Strictly Increasing Purchases](https://www.internhack.in/learn/dsa/problem/customers-with-strictly-increasing-purchases) (Hard)
89. [Department Top Three Salaries](https://www.internhack.in/learn/dsa/problem/department-top-three-salaries) (Hard)
90. [Find Cumulative Salary of an Employee](https://www.internhack.in/learn/dsa/problem/find-cumulative-salary-of-an-employee) (Hard)
91. [Find Median Given Frequency of Numbers](https://www.internhack.in/learn/dsa/problem/find-median-given-frequency-of-numbers) (Hard)
92. [Find the Subtasks That Did Not Execute](https://www.internhack.in/learn/dsa/problem/find-the-subtasks-that-did-not-execute) (Hard)
93. [Finding the Topic of Each Post](https://www.internhack.in/learn/dsa/problem/finding-the-topic-of-each-post) (Hard)
94. [First and Last Call On the Same Day](https://www.internhack.in/learn/dsa/problem/first-and-last-call-on-the-same-day) (Hard)
95. [Game Play Analysis V](https://www.internhack.in/learn/dsa/problem/game-play-analysis-v) (Hard)
96. [Get the Second Most Recent Activity](https://www.internhack.in/learn/dsa/problem/get-the-second-most-recent-activity) (Hard)
97. [Hopper Company Queries I](https://www.internhack.in/learn/dsa/problem/hopper-company-queries-i) (Hard)
98. [Hopper Company Queries II](https://www.internhack.in/learn/dsa/problem/hopper-company-queries-ii) (Hard)
99. [Hopper Company Queries III](https://www.internhack.in/learn/dsa/problem/hopper-company-queries-iii) (Hard)
100. [Human Traffic of Stadium](https://www.internhack.in/learn/dsa/problem/human-traffic-of-stadium) (Hard)

## Companies that ask database problems

- [Amazon](https://www.internhack.in/learn/dsa/companies/amazon): 65 of these problems
- [Google](https://www.internhack.in/learn/dsa/companies/google): 52 of these problems
- [Meta](https://www.internhack.in/learn/dsa/companies/meta): 48 of these problems
- [Bloomberg](https://www.internhack.in/learn/dsa/companies/bloomberg): 40 of these problems
- [Microsoft](https://www.internhack.in/learn/dsa/companies/microsoft): 39 of these problems
- [TCS](https://www.internhack.in/learn/dsa/companies/tcs): 12 of these problems
- [Cognizant](https://www.internhack.in/learn/dsa/companies/cognizant): 7 of these problems
- [Uber](https://www.internhack.in/learn/dsa/companies/uber): 6 of these problems
- [Accenture](https://www.internhack.in/learn/dsa/companies/accenture): 5 of these problems
- [Adobe](https://www.internhack.in/learn/dsa/companies/adobe): 5 of these problems
- [Apple](https://www.internhack.in/learn/dsa/companies/apple): 3 of these problems
- [Infosys](https://www.internhack.in/learn/dsa/companies/infosys): 3 of these problems

## Before your interview

Most resumes are filtered by software before a recruiter reads them. [Check your resume ATS score free](https://www.internhack.in/ats-score/try), no signup needed.

## Other DSA topics

- [Array](https://www.internhack.in/learn/dsa/array) (1869)
- [String](https://www.internhack.in/learn/dsa/string) (775)
- [Hash Table](https://www.internhack.in/learn/dsa/hash-table) (708)
- [Math](https://www.internhack.in/learn/dsa/math) (564)
- [Dynamic Programming](https://www.internhack.in/learn/dsa/dynamic-programming) (557)
- [Sorting](https://www.internhack.in/learn/dsa/sorting) (464)
- [Greedy](https://www.internhack.in/learn/dsa/greedy) (407)
- [Depth-First Search](https://www.internhack.in/learn/dsa/depth-first-search) (314)
- [Binary Search](https://www.internhack.in/learn/dsa/binary-search) (298)
- [Matrix](https://www.internhack.in/learn/dsa/matrix) (246)
- [Breadth-First Search](https://www.internhack.in/learn/dsa/breadth-first-search) (245)
- [Bit Manipulation](https://www.internhack.in/learn/dsa/bit-manipulation) (238)
- [Tree](https://www.internhack.in/learn/dsa/tree) (235)
- [Two Pointers](https://www.internhack.in/learn/dsa/two-pointers) (217)
- [Prefix Sum](https://www.internhack.in/learn/dsa/prefix-sum) (204)
- [Heap (Priority Queue)](https://www.internhack.in/learn/dsa/heap-priority-queue) (196)
- [Simulation](https://www.internhack.in/learn/dsa/simulation) (177)
- [Counting](https://www.internhack.in/learn/dsa/counting) (174)
- [Binary Tree](https://www.internhack.in/learn/dsa/binary-tree) (169)
- [Stack](https://www.internhack.in/learn/dsa/stack) (167)

## Related

- [Home](https://www.internhack.in/)
- [Learn](https://www.internhack.in/learn)
- [DSA](https://www.internhack.in/learn/dsa)
