Mega Code Archive

 
Categories / MySQL Tutorial / Insert Update Delete
 

Using encode function with insert statement

mysql> mysql> CREATE TABLE UserAccounts     -> (     ->    UserID SMALLINT NOT NULL PRIMARY KEY,     ->    Password VARCHAR(20) NOT NULL     -> ); Query OK, 0 rows affected (0.02 sec) mysql> mysql> INSERT INTO UserAccounts VALUES (101, ENCODE('pw101', 'key101')); Query OK, 1 row affected (0.00 sec) mysql> mysql> select * from UserAccounts; +--------+----------+ | UserID | Password | +--------+----------+ |    101 | ?*       | +--------+----------+ 1 row in set (0.00 sec) mysql> mysql> drop table UserAccounts; Query OK, 0 rows affected (0.00 sec) mysql>