Sql Error
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from, phone, address, type, del_flag) values('sk', 'OTHER_STATES', '01372305', '' at line 1 --> Here myQuery @Override public void save(Customers customers) { String addNew = "insert into customers(name, from, phone, address, type, del_flag) values(?, ?, ?, ?, ?, ?)"; String update = "update customers set name = ? ,from = ? ,phone = ? ,address = ? ,type = ? ,del_flag = ? where id = ?"; boolean isUpdate = customers.getId() > 0; try(Connection con = Connection_Manager.getConnection(); PreparedStatement statement = con.prepareStatement(isUpdate ? update : addNew)) { statement.setString(1, customers.getName()); statement.setString(2, customers.getRegion().name());//I created this one as enum in Customers class statement.setString(3, customers.getPhone()); statement.setString(4, customers.getAddress()); statement.setString(5, customers.getTypeOfCustomer().name());//also that one statement.setBoolean(6, customers.isDelete()); if(isUpdate) { statement.setInt(7, customers.getId()); } statement.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } }