MySQL IndexOf and Substring example

example to select the name only
SELECT INSTR('ariel@lti', '@');
SELECT SUBSTRING('MySQL Substring',7,3);

SELECT Name, Email ,
   INSTR(Email, '@') as indx,
   SUBSTRING(Email, 1INSTR(Email, '@')-1) as wow ,
   SUBSTRING(Email, 1, 9) AS nooo
FROM supplier_contact WHERE name='No Info';

 
example to select the domain only
SELECT SUBSTRING(Email, INSTR(Email, '@')+1, LENGTH(Email)) AS domain, Email
FROM supplier_contact

Comments

Popular posts from this blog

OverTheWire[.com] Natas Walkthrough - JUST HINT, NO SPOILERS

Asp.Net Ending Response options, Response.End() vs CompleteRequest()

SOLVED The item could not be indexed successfully because the item failed in the indexing subsystem