In Oracle Database, how do you extract text in-between characters? (SQL) -


i'm new @ sql , have been trying practice working oracle database.

while working on activity, came across 1 confounds me -- trying extract specific text in-between characters. specific activity cannot seem figure out using these functions is:

for table called users in column called emails, extract email domain (that is, text in-between @ , .), full email addresses:

  • mjane@yahoo.com
  • jdoe@aol.com
  • jbarry@outlook.com

becomes new column called domains values:

  • yahoo
  • aol
  • outlook

so far have been able write code isolates username to:

  • mjane
  • jdoe
  • jbarry

using code:

    `select rtrim(emails,substr(emails,instr(emails,'@')))     studentemails;` 

any extremely appreciated! i've been scratching head hours! thank you!!!

select substr(emails,               instr(emails, '@') + 1,               instr(emails, '.') - instr(emails, '@') - 1) domains users 

caveat:

i assume emails have single dot separating domain name domain type (e.g. com, net). if had email joe@domain.his.us, above query return domain being domain.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -