Selection with Limited Number of Outputs
This Tutorial's Database: petstore.db
petstore.db
There are 30 records in a single table called purchases
Fields:
pet_name
-> TEXT column of pet names of customersitem_bought
-> TEXT details the type of item boughtquantity
-> INTEGER number of the item bought within the purchase session
Query
The following would select all the purchases by the pet named "Bella"
.
Output
If we wanted to just grab the very first item in this scenario, we can limit our output by using a LIMIT
statement
New Query to Limit our output to only have one
Output
If we wanted to then grab the value after the first one, we can set an OFFSET
.
New Query to Offset our output
Output
Grabbing the 3rd, 4th, 5th purchases from our table
Query
Python Code
Output
Last updated