topic: sql Flashcards

(3 cards)

1
Q

what does sql stand for

A

structured query language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Sometimes users can have their accounts locked if they behave inappropriately. When this is
the case the locked field is set to 1 rather than 0.
Write an SQL statement that locks the account of the user Hades
using fields: users, locked , and username

A

UPDATE Users
SET locked=
WHERE username=’Hades’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The function checkAccess takes in the password the user has entered (givenPassword)
along with the password hash (passwordHash) and locked value (locked).
passwordHash and locked have already been extracted from the database before being
passed to the function. It should return the value true if a user should be allowed access to
a system and false if they aren’t.
Your function should make use of the pre-written function hash() which takes in a string and
returns the hash of that string.
e.g.
hash(“Hello”) returns f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0
Complete the function checkAccess.
function checkAccess(givenPassword, passwordHash, locked)

A

temp = hash(givenPassword)
if temp==passwordHash and locked==0 then
return true
else
return false
endif

How well did you know this?
1
Not at all
2
3
4
5
Perfectly