Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to find Select all Phone number that has number 5 6 7 in 5th 6th 7th position in the number

I’m looking for a way to print all the phone numbers (10 digit number) in collumn Phone_num of table Customer that has digit 5 6 7 in 5th 6th 7th position in the whole number, using SELECT FROM WHERE format.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You want to use the SUBSTRING function in the WHERE clause. Different databases have slightly different syntax, so you will need to look up the syntax of your database.

In SQL Server, you could write:

select phone_num from customer where substring(phone_num, 5, 3) = '567'
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading