--mysql
update student s, city c
set s.city_name = c.name
where s.city_code = c.code;
--sqlserver
update t1 set t1.name = t2.name
from user_01 t1
join user_02 t2 on t1.code = t2.code
where t2.name is not null;
--mysql
update student s, city c
set s.city_name = c.name
where s.city_code = c.code;
--sqlserver
update t1 set t1.name = t2.name
from user_01 t1
join user_02 t2 on t1.code = t2.code
where t2.name is not null;
本文主要讲述在mysql数据库中,如何使用update join实现多表数据更新。
update join SQL语法如下所示:
UPDATE T1, T2
SET T1.c2 = T2.c2,
T1.c3 = T2.c3
WHERE T1.id = T2.id AND condition
或:
UPDATE T1
INNER JOIN T2 ON T1.id = T2.id
SET T1.c2 = T2.c2
T1.c3 = T2.c3
WHERE condition
vi/vim共分为三种模式,分别是一般模式,编辑模式和命令模式。
用户刚启动vi/vim,便进入了一般模式;
在一般模式下按下i就进入了编辑模式;
在一般模式下按下:就进入了命令模式;
复制:
yy 复制当前行
nyy 从光标向下复制n行
// 0.1 + 0.2 = 0.30000000000000004 问题
console.log(0.1 + 0.2);
// 1.3333 * 150 = 199.99499999999998 问题
console.log(1.3333 * 150);
// 1.2 / 3 = 0.39999999999999997 问题
console.log(1.2 / 3);
使用示例:
mysql或oracle语法:
create table tablenew as select * from tableold;
sqlserver语法:
select * into tablenew from tableold;