Writing SQL for a datastore item
If you want to access a datastore item, you do not write SQL for it in the same way you would for a standard table.
All datastore item data will be accessed via built in functions:
functions to create/update/delete
are the main 3. You pass in an array and the database updating is done for you. There are a couple of other ones too for doing batch processing. Take a look in the code and the code docblock's to see the additional functions.
functions to get/search
The docblocks in the code for these are really well documented so if your using a modern IDE (like phpStorm )
you will see all the available comments and alternatives in the auto-completion and hinting.