Tag: PostGreSQL

  • How to use Window functions in SQL?

    SQL has evolved a lot since its widely adopted standard SQL-92. Most of the queries which developers use belong to this standard. It represents the relational database model. Markus Winand of modern-sql.com says SQL has grown five times since that standard and SQL is not just a relational database model anymore. You can store JSON…

  • How to write recursive queries in SQL?

    Let’s say you want to find out all the subordinates to a manager recursively. That is say Kiran reports to Guru and Gayathri reports to Kiran , then the subordinates of Guru are both Kiran and Gayathri. This can be done using recursive queries. Let’s see how to do it in PostgreSQL. This is supported…

  • How to do user authentication in Spring Boot using PostgreSQL database?

    Let’s say you want to create an application in Spring Boot and authenticate the users who use it against credentials stored in a PostgreSQL database. Below are the high level steps to implement it in Spring Boot: Create a spring boot project with authentication related dependencies. Add the database configuration in application.properties against which you…

  • How to map JSON data in PostGreSQL database to a Hibernate Entity column?

    PostGreSQL database is one of the most popular open source databases . It has features which traditional relational databases lack , like storing a JSON as itself in the database. JSON is a widely used communication data format and hence this feature comes quite handy. The problem arises when you use an ORM tool like…

  • How to auto generate and auto increment identifier values for PostGreSQL tables through Hibernate?

    I was trying to connect to PostGreSQL database through Spring Boot. I used spring-boot-starter-data-jpa dependency which automatically included hibernate dependencies to the project. And since I was connecting to postgresql database I included the following postgresql dependency as well: I created a simple table named my_table with an integer ID and a JSON data type…