When is the option to delete field in an attribute table enabled in QGIS? I'm in editing mode and still am not able to delete a field...
That button is only avaliable for a PostGIS layer. You can delete table columns via the "table manager" plugin.
Recent versions of QGIS support deleting Shapefile fields from the attribute table.
Enable editing and then you can edit the shapefile attribute table and multi-delete the columns you do not need.
In QGIS 3.0 there is also a button to delete attributes in the properties menu. First toggle editing (right click on a layer -> toggle editing) and go to the properties menu (right click -> properties or just double click). Go to the source fields tab, select the attributes you want to delete and click the button on top.
The "Table Manager" plugin is obsolete. It comes with a warning that it is discontinued and suggests that you use the Refactor Fields processing algorithm instead. This can work. However, another method is to save the layer with a new name, deselect the fields you wish to export, and then delete the previous version that has the fields you wanted removed after the new layer is created.
After looking around many files I found that some field definitions -- especially fields defined through an expression such as "$length" -- appear to be stored only in the *.qgs file, which (at least for QGIS 2.18.13) is an XML file, which means it is a text file that can be edited using simple text editors. The name of the QGIS layer is stored in the <layername>...</layername> element. Look for the layer of interest. The expression fields are listed in the <expressionfields>...</expressionfields> element. For example
<expressionfields> <field typeName="FLOAT" precision="0" expression="$length/1000" length="0" type="6" comment="" name="km"/> </expressionfields>
for a field named "km" whose value is calculated as $length/1000. Delete the <field>...</field> element that you don't want anymore (when the *.qgs file is not in use). Be sure to make a copy of the *.qgs file first, in case things go wrong.
You should look into RT SQL Layer plugin or Fast SQL plugin for QGIS.