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)
我想得到每个女性员工的名字和姓氏,而且没有家属,但是我被困在最后的命令部分:
select e.lname, e.fname, e.ssn
from employee e
where e.ssn not in (
select essn
from dependent
)
如何添加性别部分?
答案 0 :(得分:0)
在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'