找出emp表中的dept表没有的dept_no 使用Exists方式实现 即改写select * from emp a where a.dept_no not in (select b.dept_no from dept b)
找出emp表中的dept表没有的dept_no 使用Exists方式实现 即改写select * from emp a where a.dept_no not in (select b.dept_no from dept b)
相关考题:
以下语句不正确的是( )A.select * from emp;B.select ename,hiredate,sal from emp;C.select * from emp order deptno;D.select * from where deptno=1 and sal
基于学生.课程数据库中的三个基本表:学生信息表:s (snumber, sname, sex, age, dept)主码为snumber课程信息表:c(cnumber, cname,teacher)主码为cnumber学生选课信息表:sc(snumber, cnumber, grade)主码为(snumber, cnumber)“从学生选课信息表中找出无成绩的元组”的SQL语句是( )。A)SELECT ﹡FROM sc WHERE grade=NULLB)SELECT﹡FROM sc WHERE grade IS "C)SELECT﹡FROM sc WHERE grade IS NULLD)SELECT﹡FROM sc WHERE grade=''
Examine the structure of the EMP_DEPT_VU view:Column Name Type RemarksEMPLOYEE_ID NUMBER From the EMPLOYEES tableEMP_NAME VARCHAR2(30) From the EMPLOYEES table JOB_ID VARCHAR2(20) From the EMPLOYEES tableSALARY NUMBER From the EMPLOYEES tableDEPARTMENT_ID NUMBER From the DEPARTMENTS table DEPT_NAME VARCHAR2(30) From the DEPARTMENTS table Which SQL statement produces an error?()A. SELECT * FROM emp_dept_vu;B. SELECT department_id, SUM(salary) FROM emp_dept_vu GROUP BY department _ id;C. SELECT department_id, job_id, AVG(salary) FROM emp_dept_vu GROUP BY department _ id, job_id;D. SELECT job_id, SUM(salary) FROM emp_dept_vu WHERE department_id IN (10,20) GROUP BY job_id HAVING SUM (salary) 20000E. None of the statements produce an error; all are valid.
根据SQL标准,要查询表student中平均年龄age小于21的所在系dept及其平均年龄值,下面哪条语句适用?()A select dept,avg(age) from student where avg(age)B select dept,avg(age) from student group by dept having avg(age)C select dept,avg(age) from student having avg(age)D select dept,avg(age) from student group by dept where avg(age)
根据SQL标准,创建一个视图abc,通过该视图只能对表student中系dept为‘IS’的记录进行更新操作。下面哪条语句适用?()A create view abc as select * from student where dept=’IS’B create view abc as select * from student where dept=’IS’ with check optionC create view abc as student where dept=’IS’D create view abc as select dept=’IS’ from student
有如下SQL语句: SELECT姓名FROM学生表WHERE学号IN; (SELECT学号FROM成绩表WHERE成绩>90) 下列哪条命令与该SQL语句等价A.SELECT姓名FROM学生表WHERE EXISTS; (SELECT学号FROM成绩表WHERE成绩>90)B.SELECT姓名FROM学生表WHERE EXISTS; (SELECT学号FROM成绩表WHERE学号=学生表.学号AND成绩>90)C.SELECT姓名FROM学生表WHERE学号EXISTS; (SELECT学号FROM成绩表WHERE学号=学生表.学号AND成绩>90)D. SELECT姓名FROM学生表WHERE学号=; (SELECT学号FROM成绩表WHERE成绩>90)
对于第7题的两个基本表,有一个SQL语句: SELECT ENO, ENAME FROM EMP WHERE DNO NOT IN (SELECT DNO FROM DEPT WHERE DNAME='金工车间');其等价的关系代数表达式是:______。A.πENO,ENAME(σDNAME≠'金工车间'(EMPDEPT))B.πENO,ENAMEC.πENO,ENAME(EMP)-πENO,ENAME (σDNAME='金工车间'(EMPDEPT))D.πENO,ENAME (EMP)-πENO,ENAME (σDNAME≠'金工车间'(EMPDEPT))
利用SQL语句,检索仓库中至少有一名职工的仓库信息,正确的命令是A.SELECT*FROM仓库表WHERE IN; (SELECT仓库号FROM职工表)B.SELECT*FROM仓库表WHERE NOT IN; (SELECT仓库号FROM职工表)C.SELECT*FROM仓库表WHERE仓库号EXISTS; (SELECT*FROM职工表WHERE仓库号=仓库表.仓库号)D.SELECT*FROM仓库表WHERE EXISTS; (SELECT*FROM职工表WHERE仓库号=仓库表.仓库号)
列出EMP表中,从事每个工种(JOB)的员工人数() A.select job from emp;B.select job,count(*) from emp;C.select distinct job,count(*) from emp;D.select job,count(*) from emp group by job;E.select job,sum(empno) from emp group by job;
限制从EMP表中只选出前5条记录的查语句为()。 A.SELECT TOP 5 * FROM EMPB.SELECT DISTINCT 5 * FROM EMPC.SELECT * FROM EMP WHERE ROWNUM6D.SELECT * FROM EMP WHERE ROWNUM=5
关于HQL的聚合函数使用,说法正确的是()。A、select count(*) from Dept d用于统计部门个数B、select sum(e.salary) from Emp e用于汇总员工工资总额C、select max(e.hiredate) from Emp e用于找到最新入职的员工的入职时间D、select min(e.hiredate) from Emp e用于找到最早入职的员工的入职时间
查询出EMP表中1982年及以后入职的员工信息()(注:字段hiredate为入职日期,数据类型为DATE型)A、select * from emp where hiredate='19820101';B、select * from emp where hiredate=to_char('19820101','YYYYMMDD');C、select * from emp where to_date(hiredate,'YYYYMMDD')='19820101';D、select * from emp where to_char(hiredate,'YYYYMMDD')='19820101';
You need to display the last names of those employees who have the letter "A" as the second character in their names.Which SQL statement displays the required results?()A、SELECT last_name FROM EMP WHERE last_ name LIKE '_A%';B、SELECT last_name FROM EMP WHERE last name ='*A%'C、SELECT last_name FROM EMP WHERE last name ='_A%';D、SELECT last_name FROM EMP WHERE last name LIKE '*A%'
您需要从方案中的雇员表中删除EMP_FK_DEPT约束条件。应使用哪条语句()A、DROP CONSTRAINT EMP_FK_DEPT FROM雇员B、DELETE CONSTRAINT EMP_FK_DEPT FROM雇员C、ALTER TABLE雇员DROP CONSTRAINT EMP_FK_DEPTD、ALTER TABLE雇员REMOVE CONSTRAINT EMP_FK_DEPT
Which of the following statements eliminates all but one of each set of duplicate rows in the DEPT column in the STAFF table?()A、SELECT UNIQUE dept FROM staffB、SELECT DISTINCT dept FROM staffC、SELECT (dept) UNIQUE FROM staffD、SELECT (dept) DISTINCT FROM staff
语句SELECT * FROM dept WHERE NOT EXISTS (SELECT * FROM emp WHERE deptno=dept.deptno)执行后的结果为()A、只显示存在于EMP表中的部门全部信息B、只显示不存在于EMP表中的部门全部信息C、未返回任何数据D、显示DEPT表中的全部信息
下面的查询中哪一个会产生笛卡尔集()A、SELECT e.empno,e.ename, e.deptno, d.deptno,d.loc FROM emp e,dept d WHERE e.deptno=d.deptnoB、SELECT e.empno, e.ename, e.deptno, d.deptno,d.loc FROM emp e,dept dC、SELECT e.empno, e.ename, e.deptno, d.deptno,d.loc FROM emp e,dept d WHERE e.empno=101 and e.deptno=d.deptnoD、SELECT e.empno, e.ename, e.deptno, d.deptno,d.loc FROM emp e,dept d WHEREe.deptno=d.deptno and d.deptno=60
数据库中有一张表名为Emp,包含有如下列:EmpNO(雇员编号,Varchar(20),Pk),Job(职位Varchar(10)),HirDate(雇佣日期,Date),Sal(月薪,Float)。要求查询全部雇员信息应该是哪些数据?()A、Select * From EmpB、Select * From Emp Where EmpNO Like '%%'C、Select * From Emp Where Name = '%%'D、Select * From Emp Where Name Like '%%'
数据库中有一张表名为Emp,包含有如下列:EmpNO(雇员编号,Varchar(20),Pk),Job(职位Varchar(10)),HirDate(雇佣日期,Date),Sal(月薪,Float)。查询出职位不为“办事员”的雇员信息是()A、Select *From Emp Where Job="办事员"B、Select* From Emp Where Job==’办事员’C、Select* From Emp Where Job’办事员’D、Select* From Emp Where Job!=’办事员’
数据库中有一张表名为Emp,包含有如下列:EmpNO(雇员编号,Varchar(20),Pk),Job(职位Varchar(10)),HirDate(雇佣日期,Date),Sal(月薪,Float),Comm(奖金,Float,可为空)。查询出雇员编号为791,792,793的雇员信息是()A、Select * From Emp Where EmpNO In('791','792','793')B、Select * From Emp Where EmpNO ='791' Or EmpNO='792' OR EmpNO='793'C、Select * From Emp Where EmpNO ='791' And EmpNO='793'D、Select * From Emp Where EmpNO '791' And EmpNO'793'
Examine the description of the EMPLOYEES table: EMP_ID NUMBER(4) NOT NULL LAST_NAME VARCHAR2(30) NOT NULL FIRST_NAME VARCHAR2(30) DEPT_ID NUMBER(2) Which statement produces the number of different departments that have employees with last name Smith?()A、SELECT COUNT(*) FROM employees WHERE last_name='Smith';B、SELECT COUNT(dept_id) FROM employees WHERE last_name='Smith';C、SELECT DISTINCT(COUNT(dept_id)) FROM employees WHERE last_name='Smith';D、SELECT COUNT(DISTINCT dept_id) FROM employees WHERE last_name='Smith';E、SELECT UNIQUE(dept_id) FROM employees WHERE last_name='Smith';
查询出所有名字以’S’开始的员工()A、select * from emp where ename in 'S%';B、select * from emp where ename='S%';C、select * from emp where ename like 'S%';D、select * from emp where ename like 'S_';
限制从EMP表中只选出前5条记录的查语句为()。A、SELECT TOP 5 * FROM EMPB、SELECT DISTINCT 5 * FROM EMPC、SELECT * FROM EMP WHERE ROWNUM6D、SELECT * FROM EMP WHERE ROWNUM=5
Examine the description of the EMPLOYEES table: EMP_ID NUMBER(4) NOT NULL LAST_NAME VARCHAR2(30) NOT NULL FIRST_NAME VARCHAR2(30) DEPT_ID NUMBER(2) JOB_CAT VARCHARD2(30) SALARY NUMBER(8,2) Which statement shows the maximum salary paid in each job category of each department? ()A、SELECT dept_id, job_cat, MAX(salary) FROM employees WHERE salary MAX (salary);B、SELECT dept_id, job_cat, MAX(salary) FROM employees GROUP BY dept_id,job_cat;C、SELECT dept_id, job_cat, MAX(salary) FROM employees;D、SELECT dept_id, job_cat, MAX(salary) FROM employees GROUP BY dept_id;E、SELECT dept_id, job_cat, MAX(salary) FROM employees GROUP BY dept _ id job _ cat salary;
Examine the structure of the EMP_DEPT_VU view: Column Name Type Remarks EMPLOYEE_ID NUMBER From the EMPLOYEES table EMP_NAME VARCHAR2(30) From the EMPLOYEES table JOB_ID VARCHAR2(20) From the EMPLOYEES table SALARY NUMBER From the EMPLOYEES table DEPARTMENT_ID NUMBER From the DEPARTMENTS table DEPT_NAME VARCHAR2(30) From the DEPARTMENTS table Which SQL statement produces an error?()A、SELECT * FROM emp_dept_vu;B、SELECT department_id, SUM(salary) FROM emp_dept_vu GROUP BY department _ id;C、SELECT department_id, job_id, AVG(salary) FROM emp_dept_vu GROUP BY department _ id, job_id;D、SELECT job_id, SUM(salary) FROM emp_dept_vu WHERE department_id IN (10,20) GROUP BY job_id HAVING SUM (salary) 20000E、None of the statements produce an error; all are valid.
列出EMP表中,从事每个工种(JOB)的员工人数()A、select job from emp;B、select job,count(*) from emp;C、select distinct job,count(*) from emp;D、select job,count(*) from emp group by job;E、select job,sum(empno) from emp group by job;
单选题您需要从方案中的雇员表中删除EMP_FK_DEPT约束条件。应使用哪条语句()ADROP CONSTRAINT EMP_FK_DEPT FROM雇员BDELETE CONSTRAINT EMP_FK_DEPT FROM雇员CALTER TABLE雇员DROP CONSTRAINT EMP_FK_DEPTDALTER TABLE雇员REMOVE CONSTRAINT EMP_FK_DEPT