1
Guys , I saw the following expression in a sql video:
(union select 1,2,3 )
What does it mean ?
video link: https://www.youtube.com/watch?v=N0zAChmZIZU
1
Guys , I saw the following expression in a sql video:
(union select 1,2,3 )
What does it mean ?
video link: https://www.youtube.com/watch?v=N0zAChmZIZU
4
The function of the operator UNION is to return the DISTINCT RESULTS of 2 SELECTS
or more ( to list also the repeated results is used UNION ALL )
An example of use would be to list all cities in a table client together with a table supplier
Example:
SELECT cidade FROM Cliente UNION SELECT cidade FROM Fornecedor
If you have only 2 customers , 1 living in São Paulo and the other in Rio de Janeiro , and only 1 Supplier , from São Paulo the query will return:
São Paulo
Rio de Janeiro
Using UNION ALL for the same data:
Example :
SELECT cidade FROM Cliente UNION ALL SELECT cidade FROM Fornecedor
Upshot:
São Paulo
São Paulo
Rio de Janeiro
The video it’s about SQL INJECTION
A page that displays 3 data appears and the author uses the UNION in a query string to display 1 , 2 and 3 instead of the original data. Then it replaces the code to steal data and credentials.
Browser other questions tagged sql
You are not signed in. Login or sign up in order to post.
Do you expect people to have to follow the video to answer you? It would be nicer if you left the self-explanatory question and reproduced the whole example here.
– Bacco