How to add new columns into SQL Table those to be named as values from existing column
by 6502 from LinuxQuestions.org on (#5PNJ4)
I have an existing table TEAMS :
Code:TEAM_ID,
TEAM_NAME,
MATCH_COUNT,
SCORED_PLUS,
SCORED_MINUS,
SCORED_SUM,
POINTS_WONThe column TEAM_ID contains following numbers:
Code:1
2
4
5
6
7
10
11
12
17
22
23
24
25I need to get these numbers from column TEAM_ID and to add new columns into table TEAMS :
Code:TEAM_ID,
TEAM_NAME,
MATCH_COUNT,
SCORED_PLUS,
SCORED_MINUS,
SCORED_SUM,
POINTS_WON,
1,
2,
4,
5,
6,
7,
10,
11,
12,
17,
22,
23,
24,
25 something like next code :
Code:ALTER TABLE `TEAMS` ADD COLUMNS SELECT TEAM_ID FROM `TEAMS` smallintThe code does not work. How to add new columns into SQL Table, as I described above ?
Code:TEAM_ID,
TEAM_NAME,
MATCH_COUNT,
SCORED_PLUS,
SCORED_MINUS,
SCORED_SUM,
POINTS_WONThe column TEAM_ID contains following numbers:
Code:1
2
4
5
6
7
10
11
12
17
22
23
24
25I need to get these numbers from column TEAM_ID and to add new columns into table TEAMS :
Code:TEAM_ID,
TEAM_NAME,
MATCH_COUNT,
SCORED_PLUS,
SCORED_MINUS,
SCORED_SUM,
POINTS_WON,
1,
2,
4,
5,
6,
7,
10,
11,
12,
17,
22,
23,
24,
25 something like next code :
Code:ALTER TABLE `TEAMS` ADD COLUMNS SELECT TEAM_ID FROM `TEAMS` smallintThe code does not work. How to add new columns into SQL Table, as I described above ?