Show the detention type code for the detention with id 1?
select t1.detention_type_code from detention as t1 join ref_detention_type as t2 on t1.detention_type_code = t2.detention_type_code where detention_id = 1
Show the code and description of the least frequent detention type?
select t1.detention_type_code, t2.detention_type_description from detention as t1 join ref_detention_type as t2 on t1.detention_type_code = t2.detention_type_code group by t1.detention_type_code order by count ( * ) asc limit 1
Show the code and description of the most frequent detention type?
select t1.detention_type_code, t2.detention_type_description from detention as t1 join ref_detention_type as t2 on t1.detention_type_code = t2.detention_type_code group by t1.detention_type_code order by count ( * ) desc limit 1