final sql structure