添加一列并向该列插入数据 [英] Add a column and insert data to that column
本文介绍了添加一列并向该列插入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我有一个假设用户的表,我需要添加一列并插入默认值.
默认值在同一表(用户)中
假设用户表具有ID,名称,密码
现在,我需要在确认密码"中插入一列,该数据应与密码"值相同.
如何更改表并将值插入该列.
谁能帮我
谢谢,
Harish Reddy
Hi
I have a table assume Users and i need to add a column and insert a default value.
the default value is in the same table(Users)
assume Users table has ID, Name, Password
Now I need to insert a column as Confirm Password which data should be same as Password value.
How can I alter the table and insert the value to that column.
Can anyone help me
Thanks,
Harish Reddy
推荐答案
这里有两个步骤.
-添加新的库伦
Here is a two step approach for this.
--Add new colunm
ALTER TABLE Users
ADD ConfirmPassword Datatype NULL;
-更新表
--Update Table
UPDATE Users
SET ConfirmPassword = Password;
这篇关于添加一列并向该列插入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文