title: How to execute multiple select statement in one query in sqlite in iOS?
body: <p>Is it possible to execute two or more select statement in one query in SQLite? For example,</p>
  
  <p>We can execute create or insert query,</p>
  
  <pre><code>NSString *create_query = @"create table if not exists Employee (id integer primary key, firstName text, lastName text);create table if not exists Department (id integer primary key, department text, devision text)";
  </code></pre>
  
  <p>By using, </p>
  
  <pre><code>sqlite3_exec(self.contactDB,[create_query UTF8String], NULL, NULL, &amp;errorMessage) == SQLITE_OK)
  </code></pre>
  
  <p>we can execute it.</p>
  
  <p>But if query is something like,</p>
  
  <pre><code>NSString *select_query = @"select * from Employee;select * from Department";
  </code></pre>
  
  <p>Then is it possible to execute? If yes then how to differentiate data from <code>sqlite3_step</code>?</p>
  
  <p>Generally we are fetching data like,</p>
  
  <pre><code>if (sqlite3_prepare_v2(self.contactDB, [select_query UTF8String], -1, &amp;statement, NULL) == SQLITE_OK) {
      NSLog(@"prepared from data get");
  
      while (sqlite3_step(statement) == SQLITE_ROW) {
          NSString *department = [[NSString alloc]initWithUTF8String:(const char*)sqlite3_column_text(statement, 1)];
          NSString *devision = [[NSString alloc]initWithUTF8String:(const char *)sqlite3_column_text(statement, 2)];
  
          NSLog(@"Department : %@, Devision : %@",department,devision);
      }
      NSLog(@"errror1 is %s",sqlite3_errmsg(self.contactDB));
  }
  </code></pre>
  
  <p>But if there is a two select statement then how to identify column and row in <code>sqlite3_step</code>?</p>
  
  <p>We can execute two select statements together (i.e. select * from Employee;select * from Department ) in terminal, so it should some way in iOS I think.</p>