SQL injection is an attack that inserts malicious SQL code into input fields so that a database runs it as a command. It happens when an application builds a database query by joining user-supplied text into the query string, so the database cannot tell the intended command from the attacker's additions. The result can be exposed, changed or deleted data.
It has been well understood for many years, and the standard fix is to use parameterized queries, also called prepared statements, which keep the query structure separate from the data. Many frameworks do this by default, but unsafe code can still bypass the protection.
A WAF or input filter can block some attempts but is not a fix for the underlying flaw, because attackers can often alter their input to avoid it. How much harm an injection can do also depends on the privileges of the database account the application uses.
To reduce the risk, use parameterized queries everywhere, give the application a database account with only the permissions it needs, validate input where appropriate, keep frameworks updated and test for injection flaws. It is often used as a comparison for prompt injection, where untrusted text is likewise mixed with trusted instructions.