2021
06-09
06-09
MyBatis如何实现多表查询(多对一、一对多)
MyBatis实现多表查询 一、多对一查询数据库的准备创建两张表,一张老师表,一张学生表将老师主键id关联学生外键tid创建sql的语句createtableteacher(idintprimarykey,teacher_namevarchar(30)notnull)insertintoteacher(id,teacher_name)values(1,'毛老师')createtablestudent(idintprimarykey,student_namevarchar(30)notnull,tidintdefaultnull)//建立主外键关联altertablestudentadd...
继续阅读 >