updated sql structure