SQL Updated to new structure