A relatively newbie/wannabe developer here. I've been using various tutorials and some online examples as my current learning tools and have come across something that I'm curious about but haven't really been able to find an answer for.
Hopefully I can explain it in a manner that makes sense. I've been looking at some basic CRUD tutorials and what I've seen in most tutorials is when a SQL INSERT statement is included it is concatenated. Is there a valid reason the statements are concatenated, instead of more standard INSERT statement as per the below examples? If anyone has any information on the reasoning for this it would be greatly appreciated.
Example 1 of a concatenated INSERT statement:
String addUserSQL = "INSERT INTO users " + "VALUES (1, 'First', 'Last', 25)";
Example 2 of a concatenated INSERT statement:
String addUserSQL = "INSERT INTO users " + "(id, firstname, lastname, age) VALUES " + "(?, ?, ?, ?);";
Example of a standard INSERT statement:
String addUserSQL = "INSERT INTO users (id, firstname, lastname, age) VALUES (1, 'First', 'Last', 25)";
Thanks in advance.