A quick addendum to the other answers (which are both fine for reading back values): it is possible (and often a good idea) to change a text input field's allowed content from the default "all" to "integer", "number", or "decimal". You can do this on the edit field screen:
This is important to do if you then want to filter/sort values numerically rather than alphanumerically, ie if you want the set
[32,3,133] to be sorted as
[3,32,133] and not as
[133,3,32]. It's also important for ranges, as selecting
< 4 from the above range will select
[3,32,133] if the field's content type is 'all' but
 if the content type is 'integer'
Internally these values map to MySQL's
NUMERIC ('number') and
DECIMAL ('decimal') datatypes.
When bypassing the
channel:entries tag and pulling data direct from the DB, I tend to use the ActiveRecord plugin rather than the
query tag as:
- It's far more secure if you're inserting dynamic data into your query, eg from url segments (the
query tag does not escape variables, whereas the AR plugin does).
- It syntax is much more readable, which helps you (or another developer) to work out what you was trying to do when you return to the code months later
- There's no need to use prefixes (
exp_) when selecting tables
- It supports pagination