主要已以下两个表students与students_score,进行数据的增删改查操作!
1、SELECT
1)select id,tel from students where id in(2,6) and tel not in(‘18392868125‘); #从students表中,取出id在2和6之间的,并且tel不为‘18392868125’的数2)select id,tel from students where tel = ‘18392868125‘ limit 1; #拉出一条tel为18392868125的数据3)select distinct tel from students; #拉出tel列去重数据
运行结果示例图如下:
2、UPDATE
update students set name=(select name from students_score where id = 4 ) where id = 3; #已students_score的id=4的name值,赋值给students的id=3的name值
时间: 2024-10-06 22:13:37