别名
表别名
SELECT te.tname,GROUP_CONCAT(st.sname)
FROM
teacher as te JOIN course as co
ON te.tno = co.tno
JOIN sc
ON co.cno = sc.cno
JOIN student as st
ON sc.sno = st.sno
WHERE te.tname='oldguo'
GROUP BY te.tname;
列别名
mysql> select count(distinct(name)) from city;
+-----------------------+
| count(distinct(name)) |
+-----------------------+
| 3998 |
+-----------------------+
mysql> select count(distinct(name)) as city from city;
+------+
| city |
+------+
| 3998 |
+------+












网友评论