In SQL, How to add values after add a new column in the existing table?

前端 未结 7 1691
臣服心动
臣服心动 2021-02-14 13:34

I created a table and inserted 3 rows. Then I added a new column using alter. How can I add values to the column without using any null values?

7条回答
  •  半阙折子戏
    2021-02-14 13:49

    Suppose you have a Employee table with these columns Employee_ID, Emp_Name,Emp_Email initially. Later you decide to add Emp_Department column to this table. To enter values to this column, you can use the following query :

    Update *Table_Name* set *NewlyAddedColumnName*=Value where *Columname(primary key column)*=value
    

    Example update TblEmployee set Emp_Department='Marketing' where Emp_ID='101'

提交回复
热议问题