Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

MySQL : Execute Queries with Variables


Define the variable and set it in the server,


SET @country = 'Sri Lanka';
SET @section = 'Science Fiction';

Now you can write the query with placeholders,


SELECT book_name, isbn_number, author_id
FROM book_store 
WHERE published_in = @country 
AND category = @section;

...



This post first appeared on Devdummy, please read the originial post: here

Share the post

MySQL : Execute Queries with Variables

×

Subscribe to Devdummy

Get updates delivered right to your inbox!

Thank you for your subscription

×