Estimated reading time: 2 minutes
You have now started to understand your database structure and want to extract data from it.
The question now becomes how would you achieve this?
The most easiest way is to add a where clause into your select statement.
On the below SQLite database, we are going to retrieve certain records from the name column, using our sql query.
The objective is that when we run the SQL code , it only returns the records we asked it to show us.
Writing the SQL code to return all rows where name = Ireland
Using the below code to extract our data
select * from error_dbase.country where name = "Ireland"
it returns the following from the database
But what if we want to return more than one value?
Then you would just use an “in” statement, the SQL code would be changed as follows:
select * from error_dbase.country where name in ("Ireland","Italy")
yielding a result as follows:
and this would also work if we had more than one of the same value as follows:
So to recap, we can choose one value on its own , using the “where” clause
we can use the “in” clause to ask the code to return records of multiple selections.