Works till AOT Table (not Tested on DB)

This contains code for all table till AOT. The SQL has been tested for
accuracy however has not been tested on the DB.