CREATE TABLE activity (actid DECIMAL, activity_name TEXT)
CREATE TABLE participates_in (stuid DECIMAL, actid DECIMAL)
CREATE TABLE faculty_participates_in (facid DECIMAL, actid DECIMAL)
CREATE TABLE student (stuid DECIMAL, lname TEXT, fname TEXT, age DECIMAL, sex TEXT, major DECIMAL, advisor DECIMAL, city_code TEXT)
CREATE TABLE faculty (facid DECIMAL, lname TEXT, fname TEXT, rank TEXT, sex TEXT, phone DECIMAL, room TEXT, building TEXT)

Show all the faculty ranks and the number of students advised by each rank.
SELECT T1.rank, COUNT(*) FROM faculty AS T1 JOIN student AS T2 ON T1.facid = T2.advisor GROUP BY T1.rank
SELECT "T1"."rank", COUNT(*) FROM "faculty" AS "T1" JOIN "student" AS "T2" ON "T1"."facid" = "T2"."advisor" GROUP BY "T1"."rank"