pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedMerge Record in Database(SQL Statement)
5+ messages / 3 participants
[nested] [flat]
* Merge Record in Database(SQL Statement)
@ 2003-07-07 01:23 Shahbuddin Md Isa <shahi@unitar.edu.my>
0 siblings, 1 reply; 5+ messages in thread
From: Shahbuddin Md Isa @ 2003-07-07 01:23 UTC (permalink / raw)
To: pgsql-sql
Hai..
How to merge record in database(sql statement) if record same attribute, examples:-
Attribute Major Birth_Place GPA
Record 1 science India excellent
Record 2 science India excellent
Please help me..
____________________________________________________________
Powered by Fastmail from http://www.i-fastmail.com
^ permalink raw reply [nested|flat] 5+ messages in thread
* Merge Record in database(sql statement)
@ 2003-07-07 02:54 Shahbuddin Md Isa <shahi@unitar.edu.my>
0 siblings, 0 replies; 5+ messages in thread
From: Shahbuddin Md Isa @ 2003-07-07 02:54 UTC (permalink / raw)
To: pgsql-sql
Hai..
How to merge same record in database (sql statement), examples:-
Major Birth_Place GPA
----- ----------- -----
science India excellent
science India excellent
Please help me...
____________________________________________________________
Powered by Fastmail from http://www.i-fastmail.com
^ permalink raw reply [nested|flat] 5+ messages in thread
* Merge Record in database(sql statement)
@ 2003-07-07 02:55 Shahbuddin Md Isa <shahi@unitar.edu.my>
0 siblings, 1 reply; 5+ messages in thread
From: Shahbuddin Md Isa @ 2003-07-07 02:55 UTC (permalink / raw)
To: pgsql-sql
Hai..
How to merge same record in database (sql statement), examples:-
Major Birth_Place GPA
----- ----------- -----
science India excellent
science India excellent
Please help me...
____________________________________________________________
Powered by Fastmail from http://www.i-fastmail.com
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Merge Record in database(sql statement)
@ 2003-07-07 05:21 Markus Bertheau <twanger@bluetwanger.de>
parent: Shahbuddin Md Isa <shahi@unitar.edu.my>
0 siblings, 0 replies; 5+ messages in thread
From: Markus Bertheau @ 2003-07-07 05:21 UTC (permalink / raw)
To: Shahbuddin Md Isa <shahi@unitar.edu.my>; +Cc: pgsql-sql
В Пнд, 07.07.2003, в 04:55, Shahbuddin Md Isa пишет:
> Hai..
>
> How to merge same record in database (sql statement), examples:-
>
> Major Birth_Place GPA
> ----- ----------- -----
>
> science India excellent
> science India excellent
select distinct * from table;
--
Markus Bertheau.
Berlin, Berlin.
Germany.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Merge Record in Database(SQL Statement)
@ 2003-07-07 09:19 listrec <listrec@epecon.de>
parent: Shahbuddin Md Isa <shahi@unitar.edu.my>
0 siblings, 0 replies; 5+ messages in thread
From: listrec @ 2003-07-07 09:19 UTC (permalink / raw)
To: Shahbuddin Md Isa <shahi@unitar.edu.my>; pgsql-sql
Not quite sure what the question is....
Assuming, you would like to normalize the data, I suggest to create 4
tables:
create table gpa (id integer primary key,gpa varchar(32) not null unique);
create table major (id integer primary key,major varchar(32) not null
unique);
create table birthplace (id integer primary key,birthplace varchar(32) not
null unique);
create table xxx (
id integer primary key,
attributename varchar(64) not null, -- this might be unique too
id_major integer references major(id),
id_birthplace integer references birthplace(id),
id_gpa integer references gpa(id)
);
insert into gpa (id,gpa) values (1,'excellent');
insert into major (id,major) values (1,'science');
insert into birthplace (id,birthplace) 1,'India');
insert into xxx (id,attributename,id_major,id_birthplace,id_gpa) values
(1,'Record 1',1,1,1);
insert into xxx (id,attributename,id_major,id_birthplace,id_gpa) values
(1,'Record 2',1,1,1);
Now selecting the records would be something like:
select x.attributename,m.major,b.birthplace,g.gpa from attributename a,major
m,birthplace b,gpa g
where x.id_major=m.id and x.id_birthplace=b.id and x.id_gpa=g.id
Hope that helps....
Detlef
-----Ursprüngliche Nachricht-----
Von: pgsql-sql-owner@postgresql.org
[mailto:pgsql-sql-owner@postgresql.org]Im Auftrag von Shahbuddin Md Isa
Gesendet: Montag, 7. Juli 2003 03:24
An: pgsql-sql@postgresql.org
Betreff: [SQL] Merge Record in Database(SQL Statement)
Hai..
How to merge record in database(sql statement) if record same attribute,
examples:-
Attribute Major Birth_Place GPA
Record 1 science India excellent
Record 2 science India excellent
Please help me..
____________________________________________________________
Powered by Fastmail from http://www.i-fastmail.com
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2003-07-07 09:19 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-07-07 01:23 Merge Record in Database(SQL Statement) Shahbuddin Md Isa <shahi@unitar.edu.my>
2003-07-07 09:19 ` listrec <listrec@epecon.de>
2003-07-07 02:54 Merge Record in database(sql statement) Shahbuddin Md Isa <shahi@unitar.edu.my>
2003-07-07 02:55 Merge Record in database(sql statement) Shahbuddin Md Isa <shahi@unitar.edu.my>
2003-07-07 05:21 ` Re: Merge Record in database(sql statement) Markus Bertheau <twanger@bluetwanger.de>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox