help with scheme changes to live system.

Поиск
Список
Период
Сортировка
От Tony Yang
Тема help with scheme changes to live system.
Дата
Msg-id BAY1-F34ktJ3GOeym8Y000966ee@hotmail.com
обсуждение исходный текст
Список pgsql-sql
Hi Gurus,

Please forgive this naive question:

Say, I have a table (containerId, itemId) where for each containerId there 
are several rows (different itemId value) in that table. Now I want to give 
those rows (with same containerId) a sequence, so add one colum there to 
make it become (containerId, itemId, sequence);  how do I make such changes 
through SQL?

I know how to alter the table to insert that new column, but how do I 
populate the existed rows on that new column? note the sequence dose not 
need to confirm to any sorting of other columns, i.e., as long as there is a 
sequence is ok. for example, if I already have :

containerId  | itemId  |
1                     1001
1                     1002
1                     1003
2                     2001
2                     2002

then either

containerId  | itemId  |  sequence
1                     1001         0
1                     1002         1
1                     1003         2
2                     2001         1
2                     2002         0

or

containerId  | itemId  |  sequence
1                     1001         2
1                     1002         1
1                     1003         0
2                     2001         0
2                     2002         1

are all OK.

Thanks,
Gnale

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfee� 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963



В списке pgsql-sql по дате отправления:

Предыдущее
От: Mischa Sandberg
Дата:
Сообщение: Re: olympics ranking query
Следующее
От: "Kathrine S"
Дата:
Сообщение: ERROR: Invalid regular expression: parentheses ( ) not balanced