create table and select query