SQL injection attacks involve inserting malicious SQL statements into user input on a web form to manipulate the database. For example, an attacker could enter SQL code that returns all data from the database or deletes an entire table. Developers can prevent this by escaping special characters, validating input syntax, limiting permissions, and using bound parameters instead of concatenating user input into queries.