SQL queries to handle cascading types.