SQL injection is a type of attack where malicious code is inserted into an SQL statement via user input to manipulate a database. This can be used to access sensitive data, modify or delete records, or execute system commands. For example, a malicious user could exploit a login form that constructs SQL statements directly from user input to drop the users table by entering a crafted username containing SQL code. Proper input sanitization and using parameterized queries can prevent SQL injection.