Archive for the ‘MySQL’ Category

mySQL UCFIRST Capitalize the first letter of each word using MYSQL

for mySQL UCFIRST we need to do the following steps
1. Divide the string into two segments using mysql function SUBSTRING.
2. First part will be the single letter which we will converting that to upper case using mysql function UCASE. To acheive this we will use UCASE(SUBSTRING(‘column_name’, 1,1)).
3. Second part will be the remaining letters. We [...]

Read the rest of this entry »

mysql fetch next previous record

(SELECT * FROM zip WHERE id > 26 ORDER BY id ASC LIMIT 1)
UNION
(SELECT * FROM zip WHERE id = 26 ORDER BY id DESC LIMIT 1)
UNION
(SELECT * FROM zip WHERE id < 26 ORDER BY id DESC LIMIT 1)
order by id

Read the rest of this entry »

Optimizing MySQL: Queries and Indexes

You know the scene. The database is just too slow. Queries are queuing up, backlogs growing, users being refused connection. Management is ready to spend millions on “upgrading” to some other system, when the problem is really that MySQL is simply not being used properly. Badly defined or non-existent indexes are one of the primary [...]

Read the rest of this entry »
 

Switch to our mobile site