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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Auftrag von Shahbuddin Md Isa
Gesendet: Montag, 7. Juli 2003 03:24
An: [EMAIL PROTECTED]
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


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to