UPDATESQL

Unit 3, lesson 6 · POSITION

Finding text inside text with POSITION

Which email providers do people use?

POSITION(find IN text) gives the position where one piece of text first appears inside another, counting from 1, or 0 if it is not there. POSITION(' ' IN 'Aero wireless mouse') is 5. Combined with SUBSTR, it cuts text at a character whose position changes from row to row.

Example
SELECT name,
       SUBSTR(name, 1, POSITION(' ' IN name) - 1) AS first_word
FROM products;

Your task

List the id and the email domain (everything after the @, like 'gmail.com') of every sign-up whose email contains an @, as domain.

Tables you will use: signups

Try it in your browserFree, no sign-up. Your query is checked as you go.