I am new to SQL, and I'm currently processing a Java programmer. When I print one of my query select statements, the script contains sql syntax:
SELECT * from database WHERE id = ?
I just want to know what to do =? ? I have searched for searches and I cannot find the answer.
=?
This is not a SQL notation, but JDBC (Java Database Connectivity) . ? replaced by the parameter specified separately. Using this approach, instead of trying to substitute the parameter yourself into a string, helps prevent the risk of SQL injection .
?
? is a place holder, parameter, so you can pass it dynamically and return different results for different parameters.
Somewhere in the code, you should see that it adds this parameter to the Statement object and executes it.
Most likely you are using a tool that replaces "?" with actual value. I saw this in other tools like SQL DTS (Data Transformation Services) ... but it shows how old I am :)
? is not part of the SQL language.
? is the place owner used in SQL queries when used with JDBC Prepared Report . Using a prepared statement, advantages over a normal statement , especially when you reuse it (say, in a loop).
Here is an example:
PreparedStatement ps = connection.prepareStatement("select name from users where user_name = ?"); ps.setString(1, "user1");
"?" is replaced with "user1" when the request is run and the username with the username "user1" is returned.
Source: https://habr.com/ru/post/1394536/More articles:A serialized object works fine in my dev block, Heroku gives "TypeError (cannot throw an anonymous class class)" - ruby-on-railsEAR Version 1.4, 5, 6 - javaUPPER () and LOWER () are not required? - sqlHow to overwrite an existing cookie with a new value in PHP? - phpRails / Rspec - specification record including user verification and association membership - ruby-on-railsChanging TreeViewItem template when IsSelected and two types are selected in TreeView - wpfThe easiest way to parse XML in XHTML for applying CSS is cssWhat is the secret code that was hacked into my site? - phpnetbeans - plugins require installing the HTML Editor library - ruby-on-railsGet the number of matching characters in a regex group - phpAll Articles