order by

  1. SELECT * FROM t_student
  2. ORDER BY birthday

筛选出来的此时排序就会变成年份小的在前,大的在后。也就是年龄大的在前,小的在后。

  1. SELECT * FROM t_student
  2. ORDER BY birthday DESC

筛选出来的此时排序就会变成年份大的在前,小的在后。也就是年龄小的在前,大的在后。

两表链接

  1. SELECT t_student.name, t_student.name, t_class.class_name
  2. FROM t_student, t_class
  3. WHERE t_student.class_id = t_class.class_id

这样就会筛选出相应表的指定字段,且两表关联到了一起。这样数据就达到了拼接。

  1. SELECT t_student.name, t_student.name, t_class.class_name
  2. FROM t_student LEFT JOIN t_class
  3. ON t_student.class_id = t_class.class_id

这叫左链接,作用跟上面的写法是一样的。