What is the best way to create columns in existing table i data-base....
So now ... I have 3 different tables in database as the below tables:
àll_sites
|---------------------|------------------|
| Vendor | ops_num |
|---------------------|------------------|
| a | 1 |
|---------------------|------------------|
| b | 2 |
|---------------------|------------------|
| a | 3 |
|---------------------|------------------|
| b | 4 |
|---------------------|------------------|
| b | 5 |
|---------------------|------------------|
| a | 6 |
|---------------------|------------------|
| a | 7 |
|---------------------|------------------|
umts_carrier_mnm
|---------------------|------------------|
| ops_num | cell_name |
|---------------------|------------------|
| 1 | 11 |
|---------------------|------------------|
| 1 | 12 |
|---------------------|------------------|
| 1 | 13 |
|---------------------|------------------|
| 2 | 21 |
|---------------------|------------------|
| 2 | 22 |
|---------------------|------------------|
| 2 | 23 |
|---------------------|------------------|
| 3 | 31 |
|---------------------|------------------|
So Now I need to add more 2 columns vendor
and 'ops_num' in the below table:
umts_df_relation
|---------------------|
| cell_name |
|---------------------|
| 11 |
|---------------------|
| 12 |
|---------------------|
| 13 |
|---------------------|
| 21 |
|---------------------|
| 22 |
|---------------------|
| 23 |
|---------------------|
| 31 |
|---------------------|
So I want to add 2 columns ops_num
and 'vendor' in the previous table as the result to be like this as the below table:
umts_df_relation
|---------------------|------------------|------------------|
| cell_name | ops_num | vendor |
|---------------------|------------------|------------------|
| 11 | 1 | a |
|---------------------|------------------|------------------|
| 12 | 1 | a |
|---------------------|------------------|------------------|
| 13 | 1 | a |
|---------------------|------------------|------------------|
| 21 | 2 | b |
|---------------------|------------------|------------------|
| 22 | 2 | b |
|---------------------|------------------|------------------|
| 23 | 2 | b |
|---------------------|------------------|------------------|
| 31 | 3 | a |
|---------------------|------------------|------------------|
So this the query I want to be like as the below query:
alter table [myDB].[dbo].[umts_df_relation] add vendor varchar , ops_num INT
Now I need to fill the new columns with the va;ues related to other tables
So is there's any way to ALTER
table using query or pandas?, and what is better way to solve this, and how?
Thanks for support