As a test, I created a database containing a single table [children]. I filled it with the names of 3 girls and 2 boys, and then tried to write a program that selects the boys and girls separately and printed their names.
However, I have difficulty in binding text with sqlite3_bind_text()
It appears that sqlite3_step() returns SQLITE_DONE at once, so my loop to print the names never runs.
[snip]
#define SEX "'M'"
sqlite3_bind_text(stmt, index, SEX, sizeof(SEX), SQLITE_TRANSIENT);
Change sizeof to strlen here (and in the corresponding statement below); sqlite3_bind_text wants the length of the string, not the size of the pointer to it.