Suppose that you have to create an SQL query that includes the column names, table names, and literal values. The following code shows how you would typically write it, using traditional strings:
String query = "SELECT talk_title, speaker_name " + "FROM talks, speakers " + "WHERE talks.speaker_id = speakers.speaker_id " + "AND talks.duration > 50 ";
You can also write the code as follows, using quotes around the column or table names, depending on the target database management system:
String query = "SELECT 'talk_title', 'speaker_name' " + "FROM 'talks', 'speakers' " + "WHERE 'talks.speaker_id' = 'speakers.speaker_id' " + "AND 'talks.duration' > 50 ";
The raw string literal values are much more readable, as shown in the following code:
String query = ```SELECT 'talk_title', 'speaker_name' FROM 'talks', 'speakers' WHERE 'talks.speaker_id' = 'speakers.speaker_id' AND 'talks.duration' > 50 ```;