首页 > 其他分享 >连接查询

连接查询

时间:2023-02-28 22:46:01浏览次数:28  
标签:studentID name 查询 stu sc 连接 select

一、(知道)数据查询操作

  1、连接查询-常用方式

  内连接:连接两个表时,取的是两个表中都存在的数据

  左连接:连接两个表时,取的是左表中特有的数据,对于右表中不存在的数据用户null填充

  右连接:连接两个表时,取的是右表中特有的数据,对于左表中不存在的数据用户null填充

 

  2、(重点)内连接

    例如:方式1、select * from students stu inner join scores sc on stu.studentID = sc.studentID; (stu和sc为取的别名)

      :方式2、select * from students stu , scores sc where stu.studentID = sc.studentID;

      select stu.name,sc.courseID,sc.coore from students stu inner join scores sc on stu,studentID = sc.studentID where stu.`name`='小吴';(当name和系统某些名字重名了,name加反引号)

 

 

标签:studentID,name,查询,stu,sc,连接,select
From: https://www.cnblogs.com/wmtly/p/17166356.html

相关文章