开发者

Copying the values from specific columns from an SQL table to another table

I have two Table开发者_运维知识库s: Users and Permission. They share 2 columns with the same name, so I need to copy values of those 2 columns from 'Users' to 'Permission'. However, since there is a third column on Permission that cannot go blank, it needs to be filled with the value '0' by default.

See the diagram for further understanding:

Copying the values from specific columns from an SQL table to another table

What SQL command should I use to perform this feat?

Thanks!


insert into permission( userid, login, permission )
select UserId, login, 0 from users
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜