implemented the second SQL statement using the column based structure in spagetti code