Thread: New coloumns
Hello group, I am newbie to postgrSQL and also databases. I am making a database of proteins. In one table I have 4 columns. Is it possible that after some time, I can create as many columns depending on the requirement. if so how can I add columns to my table? Is that considered as a major overhaul of the database. Please help. Thanks best Kumar. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Kumar, While it is possible to add columns to tables, it may be a better idea to design your database slightly differently. For example, if you have a data associated with project A that gets stored into a table and there is a possibility of having projects B and C with data for the same table, instead of adding Project B column and Project C column, it makes more sense to have a column in the original table design called Project. In that column, you store "A", "B", and "C", etc., allowing the table to grow to any number of projects. Thus, instead of making extra columns, simply add a key column and your database becomes much more general and useful. Sean ----- Original Message ----- From: "Kumar S" <ps_postgres@yahoo.com> To: <pgsql-novice@postgresql.org> Sent: Monday, August 16, 2004 8:51 AM Subject: [NOVICE] New coloumns > Hello group, > I am newbie to postgrSQL and also databases. I am > making a database of proteins. In one table I have 4 > columns. > Is it possible that after some time, I can create as > many columns depending on the requirement. if so how > can I add columns to my table? Is that considered as a > major overhaul of the database. > > Please help. > > Thanks > > best > Kumar. > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) >
Thank you for your reply Sean. could you let me know or point me to a place where the SQL commands are given to add columns to an existing table. thank you. Kumar Sean Davis <sdavis2@mail.nih.gov> wrote:Kumar, While it is possible to add columns to tables, it may be a better idea to design your database slightly differently. For example, if you have a data associated with project A that gets stored into a table and there is a possibility of having projects B and C with data for the same table, instead of adding Project B column and Project C column, it makes more sense to have a column in the original table design called Project. In that column, you store "A", "B", and "C", etc., allowing the table to grow to any number of projects. Thus, instead of making extra columns, simply add a key column and your database becomes much more general and useful. Sean ----- Original Message ----- From: "Kumar S" To: Sent: Monday, August 16, 2004 8:51 AM Subject: [NOVICE] New coloumns > Hello group, > I am newbie to postgrSQL and also databases. I am > making a database of proteins. In one table I have 4 > columns. > Is it possible that after some time, I can create as > many columns depending on the requirement. if so how > can I add columns to my table? Is that considered as a > major overhaul of the database. > > Please help. > > Thanks > > best > Kumar. > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > __________________________________ Do you Yahoo!? Yahoo! Mail is new and improved - Check it out! http://promotions.yahoo.com/new_mail
Kumar, Sorry for not being specific. Variations of ALTER TABLE will do what you want: http://www.postgresql.org/docs/7.4/static/sql-altertable.html Sean -----Original Message----- From: Kumar S To: pgsql-novice@postgresql.org Sent: 8/16/2004 11:27 AM Subject: Re: [NOVICE] New coloumns Thank you for your reply Sean. could you let me know or point me to a place where the SQL commands are given to add columns to an existing table. thank you. Kumar Sean Davis <sdavis2@mail.nih.gov> wrote:Kumar, While it is possible to add columns to tables, it may be a better idea to design your database slightly differently. For example, if you have a data associated with project A that gets stored into a table and there is a possibility of having projects B and C with data for the same table, instead of adding Project B column and Project C column, it makes more sense to have a column in the original table design called Project. In that column, you store "A", "B", and "C", etc., allowing the table to grow to any number of projects. Thus, instead of making extra columns, simply add a key column and your database becomes much more general and useful. Sean ----- Original Message ----- From: "Kumar S" To: Sent: Monday, August 16, 2004 8:51 AM Subject: [NOVICE] New coloumns > Hello group, > I am newbie to postgrSQL and also databases. I am > making a database of proteins. In one table I have 4 > columns. > Is it possible that after some time, I can create as > many columns depending on the requirement. if so how > can I add columns to my table? Is that considered as a > major overhaul of the database. > > Please help. > > Thanks > > best > Kumar. > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > __________________________________ Do you Yahoo!? Yahoo! Mail is new and improved - Check it out! http://promotions.yahoo.com/new_mail ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings