SQL SELECT Boolean condition (Login) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

SQL SELECT Boolean condition (Login)

I created a simple login form that works with SQL. I don't want to request the password from the server with "SELECT password FROM users WHERE username='username';" But I would rather like to test the condition with SQL like: "SELECT (Password == inputPassword)" But I don't know the right sql code for it.

21st Apr 2018, 2:34 PM
Limitless
Limitless - avatar
1 Answer
+ 4
I came up with this solution: SELECT 'true' as Value FROM users WHERE Name = 'Username' AND password = 'Password'; so in the end if these conditions exist, it will return a single record with a single column with the value of "true"
22nd Apr 2018, 11:12 AM
Limitless
Limitless - avatar