Quantcast
Browsing all 265 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

How to get a list column names and data-type of a table in PostgreSQL?

If you are a DBA and you are working on a data-dictionary for a project so that you can keep track of schema changes and so on, then this article will help you achieve your right things. Using schema...

View Article


Image may be NSFW.
Clik here to view.

Common Issue "Can't find module 'bcrypt'" in node.js

This issue comes much time when we are using PostgreSQL with Node.js, Error: Cannot find module 'bcrypt' in nodejs application, and we try again and again to install to bcrypt using 'npm install...

View Article


Image may be NSFW.
Clik here to view.

Does PostgreSQL automatically generate an id for every row?

When I was started work on the PostgreSQL, crating first time a table, I become stuck on the Identity column because I was familiar with the MS SQL Server. So, first of all, I search the question,...

View Article

Image may be NSFW.
Clik here to view.

PostgreSQL query for Character Varying data type column with an integer value

It is difficult to change the column data-type character varying to integer in running database, but need to query the string. Suppose we have a table which column Cal_1 has integer value as string, in...

View Article

Image may be NSFW.
Clik here to view.

PostgreSQL- Select first row in each GROUP BY group

I want to select the first row of each group grouped by the PostgreSQL keyword GROUP BY. Suppose I am working on purchase reporting and I want to select the customer who has a max value of the price.I...

View Article


Image may be NSFW.
Clik here to view.

PostgreSQL - CrossTab Queries using tablefunc contrib

PostgreSQL statement uses the function crosstab to pivot the table records, pivot means I want to convert the rows to the column of particular column's value and want to the others column value...

View Article

Image may be NSFW.
Clik here to view.

PostgreSQL - Upsert query using ON CONFLICT clause

I want to insert data from a source that can contain duplicate data or data that may exist into the table, so simple I want to add data that do not exist in the table and update the table if data...

View Article

Image may be NSFW.
Clik here to view.

PostgreSQL: Function and its uses

The function is the set of PostgreSQL statements that stored on the database server and can be invoked using the SQL interface. PostgreSQL function is also known as Stored Procedure (If you are...

View Article


Image may be NSFW.
Clik here to view.

PostgreSQL: VIEW

In this article, we will learn about VIEW and how it can be managed in PostgreSQL. Firstly, we should know why we need a VIEW, while it just a group of SQL statements like function and procedure.View...

View Article


Image may be NSFW.
Clik here to view.

PostgreSQL: Materialized View

In this article we will learn about Materialized View, its need, and advantage. Also, we will learn how we can manage it in PostgreSQL? Before start Materialized View, you should take a look at the...

View Article

Image may be NSFW.
Clik here to view.

PostgreSQL: Stored Procedure

The stored procedure is introduced in PostgreSQL 11 that supports the transaction. Postgres user-defined function has a drawback, it can not execute transactions. It means, in the function, we can not...

View Article

Image may be NSFW.
Clik here to view.

PostgreSQL: Generated Column

PostgreSQL 12 introduced a new feature called generated columns. Other popular databases already support to generated columns as the Computed column and virtual column.What is a generated column?A...

View Article

Image may be NSFW.
Clik here to view.

How to concatenate the string values of a column/field in a PostgreSQL query?

This is a very popular interview question of the database, many times I faced this the question in SQL Server interview. Problem:Suppose we have the following table...

View Article


Image may be NSFW.
Clik here to view.

PostgreSQL: How to create a read only user?

Suppose you are Super Admin, sometimes you need to give the read-only permission to particular user for a safety purpose, because, it may be possible a specific user don’t have sufficient  knowledge...

View Article

Image may be NSFW.
Clik here to view.

PostgreSQL: how to select all records from one table that do not exist in...

Problem: I have two tables one is Employee, and another is Address, and I want to fetch all those records from Employee, which doesn't exist in the Address table.--EmployeeCREATETABLEemployee(...

View Article


Image may be NSFW.
Clik here to view.

PostgreSQL: How to select last record of each user

Before writing a PostgreSQL query, we will create a scenario, suppose we have two tables first are Customer, and Second is its Orders. First, we will create tables through the following query then we...

View Article

Image may be NSFW.
Clik here to view.

Insert text with single quotes in PostgreSQL

I faced an issue when tried to insert apostrophe word into the table, seeing the issue I become panic, how would I resolve this issue, so I did google surfing and found a lot of solutions, and I want...

View Article


Image may be NSFW.
Clik here to view.

PostgreSQL: How to reset primary key sequence if it falls out of sync?

Once I was working with PostgreSQL 9.4, I got an error of primary key constraint while I was using the sequence that generates the next serial number. But the sequence implied in the serial data type...

View Article

Image may be NSFW.
Clik here to view.

PostgreSQL: Generated column computed from jsonb column

Problem: I am using PostgreSQL 12 new feature Generated Column, but computing column is jsonb type that containing json as "active":true or "active":false. I have tried to create the table using the...

View Article

Image may be NSFW.
Clik here to view.

PostgreSQL: Sort result by DateTime, but the null value should be first or last

I want to sort my result by date time column in ascending order but null values ​​should come first or vice versa. Suppose I have a table employee and it has the column appraisal_date if I sorted the...

View Article
Browsing all 265 articles
Browse latest View live