I am creating a social network site in which i want to send a message to a particular person but i want the list should appear in front of me of all the names when i type the first input alphabet from database(Mysql)
In MySQL you can use the %
char for that:
SELECT field FROM table WHERE field LIKE 'a%;
(selects all fields that start with "a" following a random number of random chars)
More information: http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html
You need to use the like function along with a wildcard
See this here
MySQL:
like 'a%'
Postgresql
ilike 'a%'
Do you mean fetching only one specific letter, or a set of specific letters.
If only one letter
select * from table where field like 'a%'
If you want to use an alphabet (list of letters)
select * from table where substring(field, 1, 1) IN ('a', 'b', 'c', 'd')