How many fault logs are there in total?
select count ( fault_log_entry_id ) from fault_log
How many of those fault logs had faulty parts?
select count ( * ) from ( select fault_log_entry_id from fault_log where fault_log_entry_id in ( select fault_log_entry_id from fault_log_parts ) )
What was the fault log ID with the least number of faulty parts?
select t1.fault_log_entry_id from fault_log as t1 join fault_log_parts as t2 on t1.fault_log_entry_id = t2.fault_log_entry_id group by t1.fault_log_entry_id order by count ( * ) asc limit 1
What was its description?
select t1.fault_log_entry_id, t1.fault_description from fault_log as t1 join fault_log_parts as t2 on t1.fault_log_entry_id = t2.fault_log_entry_id group by t1.fault_log_entry_id order by count ( * ) asc limit 1
What was the fault log ID with the most number of faulty parts?
select t1.fault_log_entry_id from fault_log as t1 join fault_log_parts as t2 on t1.fault_log_entry_id = t2.fault_log_entry_id group by t1.fault_log_entry_id order by count ( * ) desc limit 1
What was its description?
select t1.fault_log_entry_id, t1.fault_description from fault_log as t1 join fault_log_parts as t2 on t1.fault_log_entry_id = t2.fault_log_entry_id group by t1.fault_log_entry_id order by count ( * ) desc limit 1
How about the record time?
select t1.fault_log_entry_id, t1.fault_description, t1.fault_log_entry_datetime from fault_log as t1 join fault_log_parts as t2 on t1.fault_log_entry_id = t2.fault_log_entry_id group by t1.fault_log_entry_id order by count ( * ) desc limit 1