Today I will show you how to pass array to Postgres Function using php. First we will create a table named country that has two columns id and name. You can run the below query to create the table. CREATE TABLE country ( id serial NOT NULL, name character varying(100), CONSTRAINT country_pkey PRIMARY KEY (id) […]
Category: PostgreSQL
Pivot Table Creation In PostgreSQL
In this post I will show you how to get data as pivot table in PostgreSQL. That is we will make the row values to appear as columns. Pivot table is a data summarization tool which is used to summarize data and display the result as another table. First we will create a table with […]
PostgreSQL Inserting Grouped Result Into Two Tables
In this post I will show you how to insert a grouped result from a table into two separate table, into a master table and then into its detail table. For example I will take the below example, where I will create the table ‘temp_detail’ which has the data that should be grouped. First we […]
Split function in PostgreSQL (PostgreSQL window function)
In this post I will show you how to get date as ‘from date’ and ‘to date’ from the same column in table. We can use split function in PostgreSQL (PostgreSQL window function) to split column into two. First we will create a new table for our example. We can use pgAdmin for creating tables and […]
nth largest value from group in PostgreSQL
In this post I will show you how to use window function in PostgreSQL to find the nth largest value from every group. You can use pgAdmin tool to create the database. First open the pgAdmin tool from start menu. After that from the object browser on the left side under Servers select ‘localhost’. Right click […]