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)
I want to get first and last names and ssn of each female employees with no dependents, but I get stuck at the final command part:
我想得到每个女性员工的姓名和ssn,没有家属,但我被困在最后的命令部分:
select e.lname, e.fname, e.ssn
from employee e
where e.ssn not in (
select essn
from dependent
)
how do I add the gender part?
如何添加性别部分?
1 个解决方案
#1
0
In SQL, you can combine multiple filters by using the AND keyword.
在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'
#1
0
In SQL, you can combine multiple filters by using the AND keyword.
在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'