order by
SELECT * FROM t_studentORDER BY birthday
筛选出来的此时排序就会变成年份小的在前,大的在后。也就是年龄大的在前,小的在后。
SELECT * FROM t_studentORDER BY birthday DESC
筛选出来的此时排序就会变成年份大的在前,小的在后。也就是年龄小的在前,大的在后。
两表链接
SELECT t_student.name, t_student.name, t_class.class_nameFROM t_student, t_classWHERE t_student.class_id = t_class.class_id
这样就会筛选出相应表的指定字段,且两表关联到了一起。这样数据就达到了拼接。
SELECT t_student.name, t_student.name, t_class.class_nameFROM t_student LEFT JOIN t_classON t_student.class_id = t_class.class_id
这叫左链接,作用跟上面的写法是一样的。
