471,108 Members | 1,327 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,108 software developers and data experts.

Select Non Alpha Contents of a Column

Is there a way to select all rows where a certain column starts with
non-alpha characters?

I would like to select all the rows that don't start with letters.

Possible?

Hunter
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #1
2 1554

--- Hunter Hillegas <li***@lastonepicked.com> wrote:
Is there a way to select all rows where a certain
column starts with
non-alpha characters?

I would like to select all the rows that don't start
with letters.

Possible?


Regular expressions would do what you want, e.g.
"select * from mytable where myfield !~ '^[a-zA-Z]';"
Look under "pattern matching" in the "functions and
operators" section of the manual (I think, working
from memory).

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #2
El Lun 29 Dic 2003 20:11, Hunter Hillegas escribió:
Is there a way to select all rows where a certain column starts with
non-alpha characters?

I would like to select all the rows that don't start with letters.

Possible?


SELECT * FROM table_name WHERE col !~* '^a-z'

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-----------------------------------------------------------------
Martín Marqués | mm******@unl.edu.ar
Programador, Administrador, DBA | Centro de Telemática
Universidad Nacional
del Litoral
-----------------------------------------------------------------
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Justin Sane | last post: by
reply views Thread by Nik Coughlin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.