在 sql 中正确使用 not in 从句,不知道如何从性别 select

using not in clause the right way in sql, don't know how to select from gender

EMPLOYEE (fmane, minit, lname, ssn, birthdate, address, sex, salary, superssn, dno) KEY: ssn
DEPARTMENT (dname, dnumber, mgrssn, mgrstartdate) KEY: dnumber.
PROJECT  (pname, pnumber, plocation, dnum) KEY: pnumber.
WORKS_ON (essn, pno, hours) KEY: (essn, pno)
DEPENDENT  (essn, dependent-name, sex, bdate, relationship) KEY: (essn, dependent-name)

我想获取每个没有家属的女员工的姓名和ssn,但我卡在了最后的命令部分:

select e.lname, e.fname, e.ssn
from employee e
where e.ssn  not in (
select essn
from dependent
)

如何添加性别部分?

在 SQL 中,您可以使用 AND 关键字组合多个过滤器。

select 
   e.lname, e.fname, e.ssn
from employee e
where e.ssn  not in (
                      select essn
                        from dependent
                     )
    AND e.sex = 'Female'