문제
MYSQL
내가 작성한 오답
select count(distinct id) COUNT
from ecoli_data
where GENOTYPE & 2 = 0
and (GENOTYPE & 1 > 0 or GENOTYPE & 3 >0 );내가 작성한 정답
select count(distinct id) COUNT
from ecoli_data
where not GENOTYPE & 2 = 0
and (GENOTYPE & 1 >0 or GENOTYPE & 4 >0 );내가 이전에 작성한 정답1
SELECT COUNT(DISTINCT ID) COUNT
FROM ECOLI_DATA
ㄴWHERE (GENOTYPE & 2 = 0)
AND
((GENOTYPE & 1 != 0) OR (GENOTYPE & 4 != 0)); 내가 이전에 작성한 정답2
: 1과 4를 하나씩 비교하지 않고 한꺼번에 비교해 distinct를 사용하지 않았다.
select count(id) count
from ecoli_data
where not (genotype & 2) = 2
and (genotype & 5) <> 0 Share article
