Q:

how do i use MySql ENUM type? (and is it right for a news feed)

I'm creating a table called news_feed, this will log all the actions a user performs.
Lets say I want to store

user1234 deleted article412 at midday

I then need a table like so
timestamp | user_id | subject_type | subject_id | method

.
there would be 5 potential methods to log, 
methods = add/edit/delete/update/report

and lets say 2 possible subject_type
subjects = article/comment

I know i could make my own key where 0=add, 1=delete etc etc but this would make my queries cumbersome to use/write as i'd need to keep consulting the key. Is there a MySql type which can read lots of identially values quickly? is this ENUM? how do i use it?!!

A:

Yes, you can use the ENUM type for this.
CREATE TABLE news_feed (
    ...
    methods ENUM('add', 'edit', 'delete', 'update', 'report'),
    subjects ENUM('article', 'comment')
);

Then just use at as you would any other field, e.g.
SELECT * FROM news_feed WHERE methods='add';

The documentation for the ENUM type has much more info.

