What is the question mark used in sql

I just surfed the net and found a query something like this:

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

what exactly does this query mean i mean what is use? in this statement.

and one more that is used also in sql.

+7
source share
6 answers

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

+8
source

what exactly does this query mean i mean what is use? in this statement.

Question marks for parameters.

and one more that is used also in sql.

& is a bitwise AND operator in sql

+2
source

Question marks are in prepared operations, which means that they are parameterized and can be called again and again without having to reconstruct the entire sql statement by simply changing the parameters. Some frameworks use the ones that come with SqlCommands. They encapsulate the leak and prevent SQL injection attacks.

Some frameworks also allow named parameters.

+1
source

Question marks must contain actual parameters.

eg.

 "select milk_rate from special_milk_rate where code_producer_id=2 and effective_from <= '20101231' and effective_till >= '20110124'" 
+1
source

Here is a good article:

http://publib.boulder.ibm.com/infocenter/idshelp/v10/topic/com.ibm.sqls.doc/sqls610.htm#sii-02prep-18104

In some statements, the parameters are not known when the expression is prepared because a different value may be inserted each time the statement is executed. In these statements, you can use the question mark (?) Where the parameter should be indicated when the statement is executed.

+1
source

& usually denotes the value of a variable or substitution that may be suggested at runtime

+1
source

All Articles