The file administrator/components/com_admin/sql/updates/mysql/4.0.0-2016-07-03.sql has duplicate single quotes making the SQL invalid
The file administrator/components/com_admin/sql/updates/mysql/4.0.0-2017-04-25.sql is executed after the administrator/components/com_admin/sql/updates/mysql/4.0.0-2017-03-18.sql file. The 2017-03-18 file drops the columns custom_data and system_data so they cannot be altered in the 2017-04-25 file.
Testing Instructions
Install a Joomla 3 website
Execute the SQL queries in the mentioned files and the correct order. You will get database errors.
Apply patch
Install a Joomla 3 website
Execute the SQL queries in the mentioned files and the correct order. There should be no errors