SQL_v1

0

Please login or register to vote for this query.

(click on this box to dismiss)

Japanese Language Meta

Q&A about the site for students, teachers, and linguists wanting to discuss the finer points of the Japanese language

-- select users coming from India and China
-- after checking logical model, the user table has all info we need

/*SELECT * FROM USERS 
WHERE Location like '%China%' 
OR 
Location like '%India%' 
OR 
Location like '%USA%'*/

-- Rewrite by using Case Then -- 
SELECT ID, Location, 'Country coming from' =

CASE WHEN Location like '%India%' THEN 'coming from India'
  WHEN Location like '%China%'THEN 'coming from China'
  WHEN Location like '%USA%' THEN'coming from USA'
  ELSE 'coming from Other Countries'
  END 
  From USERS;

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results