Cross-site Scripting or XSS occurs when an attacker inserts malicious code into a user's browser or redirects to another location to steal information. On the other hand, SQL is a kind of attack where an attacker targets a database to access user data.