Creating a statement and executing an SQL query