user2855405
user2855405

Reputation: 515

SQL query extracting first few characters

So I have a column in my 'abc' table called 'phones' I need to select everything from the table but only for the people with '520' area codes and the the format for the phone numbers are like so : (540)333-4534 and (804)232-2222.

I am completely new to SQL and this is over my head so any help would be awesome.

I have so far:

SELECT * 
FROM abc
WHERE phones?????????

Upvotes: 1

Views: 76

Answers (1)

Kevin Bowersox
Kevin Bowersox

Reputation: 94479

Use a like statement with a wildcard:

SELECT * 
FROM abc
WHERE trim(phones) like '(520)%'

Upvotes: 4

Related Questions