I'm new to python and have been trying to learn how to use it within ArcGIS. I have primarily been using the free Penn State courseware available here - http://open.ems.psu.edu/courseware
I have understood most of the content, however, I am struggling to understand how the instructors have incorporated the SQL query into this script:
(The comments and course notes related to this scrip can be viewed here - https://www.e-education.psu.edu/geog485/node/136)
import arcpy
fc = arcpy.GetParameterAsText(0)
affectedField = arcpy.GetParameterAsText(1)
oldValue = arcpy.GetParameterAsText(2)
newValue = arcpy.GetParameterAsText(3)
queryString = '"' + affectedField + '" = '+ "'" + oldValue + "'"
rows = arcpy.UpdateCursor(fc, queryString)
row = rows.next()
while row:
row.setValue(affectedField, newValue)
rows.updateRow(row)
row = rows.next()
del row, rows
The above script is used to update the attribute table in ArcGIS. In line 8 an SQL query is used to identify a particular name that I want to change (I used a work related attribute table here and wanted to change the name of a city from 'Aberdeen' to 'Newcastle'). However, having very little experience with SQL I am not sure what the instructors mean or how to apply it to my own task
Could anyone please help me to understand what the SQL query in line 8 means and how to use it to complete my task?
Thanks,
Chris