mysql把一个表的字段赋值到另一张表,多表之间常用的操作

文章目录

mysql多表之间的常用操作

1. 根据主键,把一个表的字段赋值到另一张表

user

userId

username

password

sex

addr

phone

1

张珊

123

北京市

1562356586

2

李思

456

北京市

1562354256

score

scoreId

userId

username

score

course

phone

1

1

80

语文

2

1

85

数学

需求:根据userIduser表的 usernamephone字段填充到score表中

update score,user
set score.username =

猜你喜欢

转载自blog.csdn.net/m0_61083409/article/details/125157134