Name

DECODE( )

Synopsis

DECODE(encrypted, password)

This function decrypts a given string that was encrypted with a given password.

SELECT ENCODE(pwd, 'oreilly')
FROM teachers
WHERE teacher_id = '730522';

This function decrypts the contents of the pwd column and unlocks it using the oreilly password, which was used to encrypt it originally using ENCODE( ).

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.