Hi I would like to know how to perform SQL like queries using solidity? I want to write a Dapp that records a string transaction, say, a user name each time. Also I want to be able to look up whether this username exists on the Ethereum blockchain. I know I can easily use any database system. However I want my app to be able to run on Ethereum itself. What is the correct way to do that?
There us no sql-like queries.
To store your data you could use a
mapping which is similar to a hashtable (key/value storage) or an
array or just a simple variable (with set/get) : read the doc here. Every contract has its own storage which is theoretically unlimited (you should just be aware of the storage cost).
e.g of mapping use :
mapping(uint=> string) username; // a map linking each user(which is a string) with a key(which is a uint).
to store the desired username just provide its key. E.g:
uint i=1; username="yanguri";
so you guess it to retrieve your username use
Additional information : read about the differenece between Array an Mapping http://solidity.readthedocs.io/en/develop/introduction-to-smart-contracts.html