Union Query SQL injection is a type of in-band injection attack that allows an attacker to extract information from the database quickly. This attack utilises the SQL UNION operator. This attack allows the attacker to combine more than one SQL commands into one SQL command. The response generated from the server is returned as HTTP response.
The below code shows when an attacker gets the number of columns by using other injection attacks.