But it is a good example of something that should probably be in your database. There are several ways to handle such data in the database.
select
case
when row=1 then 'Sorcerer'
when row=2 then 'Druid'
when row=3 then 'Paladin'
when row=4 then 'Knight'
end as char_class
from ...
That way doesn't store the char_class value in the db.
There's
smarlowe=# create table char_class (id int primary key, nam text);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "char_class_pkey" for table "char_class"
CREATE TABLE
smarlowe=# insert into char_class values (1,'Sorcerer'), (2,'Druid'), (3,'Paladin'), (4,'Knight');
smarlowe=# create table chars (id int primary key, nam text, cclass int references char_class(id));
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "chars_pkey" for table "chars"
CREATE TABLE
smarlowe=# insert into chars values (1,'joe',1);
INSERT 0 1
smarlowe=# insert into chars values (2,'sally',2);
INSERT 0 1
smarlowe=# insert into chars values (3,'sam',4);
INSERT 0 1
smarlowe=# insert into chars values (4,'frank',3);
INSERT 0 1
smarlowe=# select c.nam as username, cc.nam as charclass from chars c join char_class cc on (c.cclass=cc.id);
username | charclass
----------+-----------
joe | Sorcerer
sally | Druid
sam | Knight
frank | Paladin
(4 rows)
This was stores the class in the db and references it for the user.