mysql-使用笔记-20210211
表b向着表a写数据
insert INTO a (`id`,`name`,`sexs`) SELECT `id`,`name`,`sexs` FROM b;
查询节目id
SELECT count(id) FROM jiemu WHERE name IN (SELECT * FROM name);
SELECT COUNT(*) FROM jiemu;
SELECT COUNT(*) FROM jmname;
SELECT n.name,jm.id
FROM jmname AS n
LEFT JOIN jiemu AS jm
ON n.name=jm.name;
查询节目ID
左外连接查询解决此问题,
SELECT jm.name, jm.id
FROM jmname AS n
LEFT JOIN jiemu AS jm ON jm.name=n.name;
mysqluser
SELECT * FROM jiemu WHERE NAME='2017天天向上(1月)';
SELECT * FROM jiemu WHERE NAME IN (SELECT * FROM jmname);
查询节目ID
SELECT t.name,s.nid
FROM bbb AS t
left JOIN aaa s
on s.name=t.name
;
SELECT * FROM tname WHERE name = '超级飞侠第八季02'
SELECT * FROM jiemu;
查询相同的节目
ee库中有dd种没有的 下架单
select * from ee
where not exists(select * from dd where ee.ID=dd.ID and ee.NAME=dd.NAME);
dd洪有ee中没有的 上架单
select * from dd
where not exists(select * from ee where ee.ID=dd.ID and ee.NAME=dd.NAME);
学之如大海汪洋,薄积厚发,后发制人,大学之道也。