The main idea is that the attacker sends malicious SQL commands to the database server, exploiting the behaviour of the web page interface.
The typical method is to permaturely terminate a text string within the input, and append a new command. The assumption is that the webpage will construct the query to the database by simply concatenating each part of the command with the user's input.
An SQL injection attack can come from many avenues: