public static void changeNumber(String name, String surname, String newNumber) { 

Explain why this does not work:

 try { String query = "UPDATE applicants SET phone_number= "+newNumber+" " + "WHERE first_name= "+name+" "; 

"SQL error or missing database (no such column: Joseph)"

A works like this:

 try { String query = "UPDATE applicants SET phone_number= "+newNumber+" " + "WHERE first_name= 'Joseph' "; 

And phone_number sees in both cases

    1 answer 1

    The fact is that in the first example, you substitute a string value without single quotes. As a result, in the WHERE DBMS treats this value as a column name.

    PS In general, form a SQL query by concatenation method, this is bad practice. Better use partial requests. This will immediately relieve a lot of problems.