把某字段第10位设置为1
update tests set uid = uid|(1 << 10) where id=1;
把某个字段第10位设置为0
update tests set uid = uid&~(1 << 10) where id=1;
把某字段第10位设置为1
update tests set uid = uid|(1 << 10) where id=1;
把某个字段第10位设置为0
update tests set uid = uid&~(1 << 10) where id=1;
CREATE DATABASE IF NOT EXISTS 数据库名字 DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;
SELECT @rowNum:=@rowNum + 1 AS ‘行号’,a.* FROM Teacher a,(SELECT @rowNum:=0) b;
DELETE p from a p inner JOIN b i on p.id=i.pic_id where ……;
where条件之后随便写
1、使用not in,容易理解,效率低
select distinct A.ID from A where A.ID not in (select ID from B)
2、使用left join…on… ,B.ID isnull表示左连接之后在B.ID字段为null的记录
select A.ID from A left join B on A.ID=B.ID where B.ID is null