How to get Apex Job associated with Scheduled Job

Introduction

You might have stumbled up upon a requirement to know the apex class behind the scheduled job (or even apex job) which is found under Setup >> Scheduled Job and this does not show the name of Apex.

Solution

SELECT CronTrigger.CronJobDetail.name, ApexClassId, Id, JobItemsProcessed, JobType, Status, NumberOfErrors, MethodName FROM AsyncApexJob WHERE JobType IN ('BatchApexWorker', 'ScheduledApex')