added sql code to demo tables and some fixes