언어
비트연산
땅호720
2024. 7. 2. 13:18
select id, email, first_name, last_name
from developers as d
where d.skill_code & (select code from skillcodes where name="Python") != 0
or d.skill_code & (select code from skillcodes where name="C#") != 0
order by id
/*
SELECT *
FROM DEVELOPERS D, SKILLCODES S
WHERE 1 = 1 -- always TRUE (outer join)
AND (SKILL_CODE & S.CODE) != 0
AND NAME IN ('Python', 'C#')
ORDER BY ID;
*/
select count(*) 'COUNT'
from ecoli_data
where ((GENOTYPE & 1) or (GENOTYPE & 4))
and not (GENOTYPE & 2)
-- and GENOTYPE ^ 2
-- and GENOTYPE | 2
-- '두 번째 형질이 없다'는 조건으로 찾을 때, 다른 형질 있으면 TRUE가 되므로
-- '두 번째 형질이 있지 않은 조건'이 더욱 확실