SQL for missing security tables