Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is use of question mark in sql [duplicate]

Tags:

sql

I was just surfing the net and found a query something like:

sql  = "select milk_rate from special_milk_rate 
        where code_producer_id=? and effective_from <= ? 
        and effective_till >= ?"

what exactly this query means i means what is the use of ? in this statement.

and one thing more what is use of & in sql.

like image 779
codeomnitrix Avatar asked Jan 23 '11 12:01

codeomnitrix


2 Answers

This usually implies a prepared statement, where the parameters are filled in later. (see e.g. http://en.wikipedia.org/wiki/Prepared_statements#Parameterized_statements).

like image 198
Oliver Charlesworth Avatar answered Nov 08 '22 07:11

Oliver Charlesworth


what exactly this query means i means what is the use of ? in this statement.

The question marks are for parameters.

and one thing more what is use of & in sql.

& is a bitwise AND operator in sql

like image 27
RichardTheKiwi Avatar answered Nov 08 '22 05:11

RichardTheKiwi