Writing SQL for a datastore item
You don't.
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
jrCore_db_create_item() //create
jrCore_db_update_item() //update
jrCore_db_delete_item() //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
jrCore_db_get_item() //create
jrCore_db_search_items() //update
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.