Hibernate is one of the most popular, open-source ORM (Object Relational Mapping) framework, which has now become a standard for developing persistence layer on Java enterprise application, along with JPA (Java Persistence API). I often receive requests to suggest which book is best to learn to hibernate or recommendation about some good books and training courses on Spring and Hibernate. This motivates me to write this article about some of the best books on Hibernate currently available on the market.
Disclosure: This article may contain affiliate links. When you purchase, we may earn a small commission.
How to setup JNDI Database Connection pool in Tomcat - Spring Tutorial Example
Setting the JNDI Database Connection pool in Spring and Tomcat is pretty easy. Tomcat server documentation gives enough information on how to set up a connection pool in Tomcat 5, 6, 7, 8, or 9. Here we will use Tomcat 7 along with the spring framework for creating a connection pool in the Tomcat server and accessing them in Spring using JNDI code. In our last article, we have seen how to set up a database connection pool in Spring for a core Java application that doesn't run on a web server or application server and doesn't have a managed Java EE container.
SQL Self Join Example - SQL Query to Find Employees Earning More Than Managers - LeetCode Solution
Hello guys, are you looking for a simple example of how to use SELF JOIN in SQL? If yes, then you have come to the right place. This article will show you how to use Self join in solving interesting SQL problems from LeetCode. Along the way, you will also learn this useful SQL concept. So, what are you waiting for? Let's first check the problem, and then we'll write an SQL query using SELF Join to solve this problem.
Write an SQL Query to Find Employees Earning More Than Managers
The Employee table holds all employees, including their managers. Every employee has an Id, and there is also a column for the manager Id, as shown below:
+----+-------+--------+-----------+
| Id | Name | Salary | ManagerId |
+----+-------+--------+-----------+
| 1 | Joe | 70000 | 3 |
| 2 | Henry | 80000 | 4 |
| 3 | Sam | 60000 | NULL |
| 4 | Max | 90000 | NULL |
+----+-------+--------+-----------+
Given the Employee table, write a SQL query that finds employees who earn more than their managers. For the above table, Joe is the only employee who earns more than his manager because Henry's Manager is Max, who earns 90000, which is more than Henry's salary of 80000.
Write an SQL Query to Find Employees Earning More Than Managers
The Employee table holds all employees, including their managers. Every employee has an Id, and there is also a column for the manager Id, as shown below:
+----+-------+--------+-----------+
| Id | Name | Salary | ManagerId |
+----+-------+--------+-----------+
| 1 | Joe | 70000 | 3 |
| 2 | Henry | 80000 | 4 |
| 3 | Sam | 60000 | NULL |
| 4 | Max | 90000 | NULL |
+----+-------+--------+-----------+
Given the Employee table, write a SQL query that finds employees who earn more than their managers. For the above table, Joe is the only employee who earns more than his manager because Henry's Manager is Max, who earns 90000, which is more than Henry's salary of 80000.
Labels:
Microsoft SQL Server
,
SQL
,
SQL Interview Questions
Difference between row_number(), rank() and dense_rank() window functions in SQL
Though all three are ranking functions in SQL, also known as a window function in Microsoft SQL Server, the difference between rank(), dense_rank(), and row_number() comes when you have ties on ranking i.e. duplicate records. For example, if you are ranking employees by their salaries then what would be the rank of two employees of the same salaries? It depends on which ranking function you are using like row_number, rank, or dense_rank.
Labels:
Microsoft SQL Server
,
SQL
,
SQL Interview Questions
Subscribe to:
Posts
(
Atom
)