515439429 发表于 2018-10-7 06:59:52

MySQL的开发必会的sql语句

select * from userinfo5,department5  select * from userinfo5,department5 where userinfo5.part_id = department5.id
  select * from userinfo5 left join department5 on userinfo5.part_id = department5.id
  select * from department5 left join userinfo5 on userinfo5.part_id = department5.id
  # userinfo5左边全部显示
  # select * from userinfo5 right join department5 on userinfo5.part_id = department5.id
  # department5右边全部显示
  select * from userinfo5 innder join department5 on userinfo5.part_id = department5.id
  将出现null时一行隐藏
  select * from
  department5
  left join userinfo5 on userinfo5.part_id = department5.id
  left join userinfo6 on userinfo5.part_id = department5.id
  select
  score.sid,
  student.sid
  from
  score
  left join student on score.student_id = student.sid
  left join course on score.course_id = course.cid

  left join>  left join teacher on course.teacher_id=teacher.ti
  select count(id) from userinfo5;

页: [1]
查看完整版本: MySQL的开发必会的sql语句