I have switched from mysql to Dynamo DB .In mysql i have used a query for fetching all the users nearer to a particular latitude and longitude.The query is
SELECT *,SQRT( POW( 69.1 * ( latitude - $latitude) , 2 ) + POW( 69.1 * ( $longitude - longitude ) * COS( latitude / 57.3 ) , 2 ) ) AS distance FROM coupon WHERE is_active='Y' HAVING distance<=$radius
is it possible to create a query like in Dynamo DB.I am using PHP as my Backend
No, Amazon DynamoDB does not offer complex SQL queries like this one out of the box, after all, something has to go when you want to use a NoSQL database 😉
However, given that DynamoDB has been developed specifically for use cases requiring fast and predictable performance with seamless scalability, which usually implies respectively large datasets, it provides integration with Amazon Elastic MapReduce (Amazon EMR) for use cases like yours:
You may want to read into Exporting, Importing, Querying, and Joining Tables in Amazon DynamoDB Using Amazon EMR for details, which summarizes Querying live Amazon DynamoDB data using SQL-like statements (HiveQL), amongst other things. While HiveQL provides a bit more than DynamoDB itself, it is still a simple SQL-like query language, and mathematical expressions like yours are not covered.
For these you’d need to dive into Hadoop and MapReduce (as provided by the DynamoDB EMR integration), as it allows you to do pretty much anything what you want with your data (see e.g. How to Create a Job Flow Using a Custom JAR).