new graph approach sql queries