student表中有字段:sno.ssex,class,sname,sbirthday
course表中有字段:cno,cname,tno
score表中有字段:sno,cno,degree
teacher表中有字段:tno,tname,tsex,trof,tbirthday,depart查询所有教师和同学的name、sex和birthday.

解决方案 »

  1.   

    select sname,ssex,sbirthday from student
    uinon
    select tname,tsex,tbirthday
      

  2.   

    (select tname as name,tsex as sex,tbirthday as birth from teacher)
    union all  
    (select sname as name,seex as sex,sbirthday as birth from student)
      

  3.   

    (select tname as name,tsex as sex,tbirthday as birth,'同学' as diffe from teacher)
    union all  
    (select sname as name,seex as sex,sbirthday as birth,'老师' as diffe from student)
      

  4.   


    select sname as name,ssex  as sex,sbirthday as birthday from student
    uinon all
    select tname,tsex,tbirthday from teacher
      

  5.   

    select m.sname name , m.ssex sex , m.sbirthday birthday from student m
    union all
    select m.tname name , m.tsex sex , m.tbirthday birthday from teacher m