Skip site navigation (1) Skip section navigation (2)

Re: Select row cells as new columns

From: lewbloch(at)gmail(dot)com
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Select row cells as new columns
Date: 2012-05-31 16:55:27
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
danycxxx wrote:
> Yes, I've looked at it, but id doesn't create the desired output. After more
> research I've found that I my design is similar to Entity, Attribute and
> Value(EAV) design and I think I have to redesign. Any suggestion regarding
> EAV? Is there any other approach?

EAV is controversial. I am uncomfortable with it because it implements 
keys as values.

I suggest that you not use EAV. Its putative flexibility comes at a large 
implementation price.

The other approach is relational database design. You model an entity as 
a collection of tables, each of which represents an aspect of the data 
pertinent to the entity. Each table has columns, the labels of which 
correspond generally to the names of attributes for that aspect. Each 
row of each table provides values for its respective named columns.

So a table roughly models what I'll call an "entitylet" - a cohesive piece 
of the entity model.

The rules to decompose entity models into relational data models 
constitute "normalization". I suggest you create a relational data model 
normalized to at least third normal form.


In response to

pgsql-sql by date

Next:From: lewblochDate: 2012-05-31 16:56:29
Subject: Re: Job control in sql
Previous:From: chester c youngDate: 2012-05-30 03:33:35
Subject: Re: possible bug in psql

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group