Database access is critical to any project. It's easy to low down the performance with heavy queries, or using multiple queries to get a simple information. Or even that initial query that cascade to dozens of others using programming... And everything gets worse if the database has lots of data or a poorly designed query! Each query has a high cost to your application. It's possible to solve this kind of problems using CTE (Common Table Expression). This powerful resource is available on most of the relational database but isn't well known by developers. Deal with a significant amount of data with simple maintenance and drastically increase your database performance!