Introduction
When you want to find data in a database, you can either look through everything or search smartly. Scanning checks every item, which can be slow. Querying looks only where it needs to, making it faster and cheaper.
When you need to find a few specific items quickly in a large database table.
When you want to avoid reading the whole table to save time and cost.
When you have a known key or index to search by in your data.
When you want to get all items regardless of keys, but understand it will be slower.
When you want to filter data but don't have a key to query on.