SQL Query for assembly BOM?

Is there a SQL query that can do what the BOM tab does?  I assume there is a SQL query in the background to find the bom data.  Any examples out there?

SolidworksSolidworks Pdm enterprise Pdm