Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i am new to database querying so apologies for this rudimentary query question. thank you in advance.

table called "neuron"  
columns in "neuron" called "neuron_id", "neuron_name" + others (not relevant here)

neuron_id is unique identifier for each neuron_name;
say there are 5 entries, thus
neuron_id = 1,2,3,4,5 and corresponding
neuron_name = a,b,c,d,e

i would like to generate a list that contains neuron_id for select neuron_name. the following query does not work for me.

select neuron_id, neuron_name  
from neuron  
where neuron_name = "a" or "c" or "e"

i expect the following


but the above query only spits out

share|improve this question
WHERE neuron_name IN ('a', 'c', 'e') – ypercubeᵀᴹ Feb 12 '14 at 15:03
thank you Max for the format edits. – rsp Feb 13 '14 at 16:52

Try this:

select neuron_id, neuron_name  
from neuron  
where neuron_name = "a" or neuron_name = "c" or neuron_name = "e"


The solution from ypercube is more semantically correct.

select neuron_id, neuron_name  
from neuron  
where neuron_name IN ('a', 'c', 'e')
share|improve this answer
thank you. this worked! – rsp Feb 13 '14 at 16:54

Copy and modify this.

select * from seq_region where (name = 'MtDNA' or name = 'IV');

We're both biologists! HTH, Paul...
(first solution possibly more elegant, but with OR you can add other fields - YMMV)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.