单选题Given the following table definitions: EMPLOYEE ID NAME DEPTID 01Smith 10 02Bossy 20 03 20 Peterson 04Goss 30 05Pape 40 06Avery 50 07O'Neal 60 08Carter 50 DEPARTMENT ID DEPTNAME 05 Hardware 10 Kitchen 20 Shoes 30 Toys 40 Electronics 50 Automotive and t

题目
单选题
Given the following table definitions: EMPLOYEE ID NAME DEPTID 01Smith 10 02Bossy 20 03 20 Peterson 04Goss 30 05Pape 40 06Avery 50 07O'Neal 60 08Carter 50 DEPARTMENT ID DEPTNAME 05 Hardware 10 Kitchen 20 Shoes 30 Toys 40 Electronics 50 Automotive and the following query: SELECT e.id, d.deptname FROM employee e, department d WHERE e.deptid = d.id AND e.id > 4 Which of the following queries will produce the same result set as the query above?()
A

SELECT e.id, d.deptname FROM employee e, department d WHERE e.id > 4

B

SELECT e.id, d.deptname FROM employee e INNER JOIN department d ON e.deptid = d.id WHERE e.id > 4

C

SELECT e.id, d.deptname FROM employee e FULL OUTER JOIN department d ON e.id = d.id WHERE e.id > 4

D

SELECT e.id, d.deptname FROM employee e LEFT OUTER JOIN department d ON e.deptid = d.id WHERE e.id > 4 UNION ALL SELECT e.id, d.deptname FROM employee e RIGHT OUTER JOIN department d ON e.deptid = d.id WHERE e.id > 4

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Given the following table definitions:EMPLOYEEID NAME DEPTID01Smith 1002Bossy 2003 20Peterson04Goss 3005Pape 4006Avery 5007O‘Neal 6008Carter 50DEPARTMENT ID DEPTNAME05 Hardware 10 Kitchen 20 Shoes 30 Toys 40 Electronics 50 Automotive and the following query: SELECT e.id, d.deptname FROM employee e, department d WHERE e.deptid = d.id AND e.id > 4Which of the following queries will produce the same result set as the query above?()

A.SELECT e.id, d.deptname FROM employee e, department d WHERE e.id > 4

B.SELECT e.id, d.deptname FROM employee e INNER JOIN department d ON e.deptid = d.id WHERE e.id > 4

C.SELECT e.id, d.deptname FROM employee e FULL OUTER JOIN department d ON e.id = d.id WHERE e.id > 4

D.SELECT e.id, d.deptname FROM employee e LEFT OUTER JOIN department d ON e.deptid = d.id WHERE e.id > 4 UNION ALL SELECT e.id, d.deptname FROM employee e RIGHT OUTER JOIN department d ON e.deptid = d.id WHERE e.id > 4


参考答案:B

第2题:

序列( )可能是第一趟冒泡排序后的结果。

A.40 10 20 30 70 50 60
B.20 30 10 40 70 50 60
C.30 10 40 20 70 60 50
D.20 30 10 40 60 50 70

答案:D
解析:
本题考查数据结构与算法基础知识。
n个记录进行冒泡排序的方法是:首先将第一个记录的关键字和第二个记录的关键字进行比较,若为逆序,则交换两个记录的值,然后比较第二个记录和第三个记录的关键字,依此类推,直至第n-1个记录和第n个记录的关键字比较完为止。上述过程称作一趟冒泡排序,其结果是关键字最大的记录被交换到第n个位置。然后进行第二趟冒泡排序,对前n-1个记录进行同样的操作,其结果是关键字次大的记录被交换到第n-1个位置。当进行完第n-1趟时,所有记录有序排列。
显然,第一趟冒泡排序后最大元素会交换至序列末端。

第3题:

Examine the data in the EMPLOYEES and DEPARTMENTS tables:

EMPLOYEES

EMP_NAME DEPT_ID MGR_ID JOB_ID SALARY

EMPLOYEE_ID

101 Smith 20 120 SA_REP 4000

102 Martin 10 105 CLERK 2500

103 Chris 20 120 IT_ADMIN 4200

104 John 30 108 HR_CLERK 2500

105 Diana 30 108 IT_ADMIN 5000

106 Smith 40 110 AD_ASST 3000

108 Jennifer 30 110 HR_DIR 6500

110 Bob 40 EX_DIR 8000

120 Ravi 20 110 SA*DIR 6500

DEPARTMENTS

DEPARTMENT_ID DEPARTMENT_NAME

10 Admin

20 Education

30 IT

40 Human Resources

Also examine the SQL statements that create the EMPLOYEES and DEPARTMENTS tables:

CREATE TABLE departments

(department_id NUMBER PRIMARY KEY,

department _ name VARCHAR2(30));

CREATE TABLE employees

(EMPLOYEE_ID NUMBER PRIMARY KEY,

EMP_NAME VARCHAR2(20),

DEPT_ID NUMBER REFERENCES

departments(department_id),

MGR_ID NUMBER REFERENCES

employees(employee id),

MGR_ID NUMBER REFERENCES

employees(employee id),

JOB_ID VARCHAR2(15).

SALARY NUMBER);

ON the EMPLOYEES,

On the EMPLOYEES table, EMPLOYEE_ID is the primary key.

MGR_ID is the ID of managers and refers to the EMPLOYEE_ID. DEPT_ID is foreign key to DEPARTMENT_ID column of the DEPARTMENTS table. On the DEPARTMENTS table, DEPARTMENT_ID is the primary key.

Examine this DELETE statement:

DELETE

FROM departments

WHERE department id = 40;

What happens when you execute the DELETE statement?()


参考答案:B

第4题:

Examine the structure of the EMPLOYEES and DEPARTMENTS tables: EMPLOYEESColumn name Data type Remarks EMPLOYEE_ID NUMBER NOT NULL, Primary Key EMP_NAME VARCHAR2 (30) JOB_ID VARCHAR2 (20) SALARY NUMBER MGR_ID NUMBER References EMPLOYEE_ID COLUMN DEPARTMENT ID NUMBER Foreign key to DEPARTMENT ID column of the DEPARTMENTS table DEPARTMENTSColumn name Data type Remarks DEPARTMENT_ID NUMBER NOT NULL, Primary Key DEPARTMENT_NAME VARCHAR2(30) MGR_ID NUMBER References MGR_ID column of the EMPLOYEES table Evaluate this SQL statement: SELECT employee_id, e.department_id, department_name, salary FROM employees e, departments d WHERE e. department_id = d.department_id; Which SQL statement is equivalent to the above SQL statement?()

  • A、SELECT employee_id, department_id, department_name, salary FROM employees WHERE department_id IN (SELECT department_id FROM departments);
  • B、SELECT employee_id, department_id, department_name, salary FROM employees NATURAL JOIN departments;
  • C、SELECT employee_id, d.department_id, department_name, salary FROM employees e JOIN departments d ON e.department _ id = d. department_id;
  • D、SELECT employee_id, department_id, department_name, Salary FROM employees JOIN departments USING (e.department_id, d.department_id);

正确答案:C

第5题:

Examine the structure of the EMPLOYEES and DEPARTMENTS tables: EMPLOYEESColumn name Data type Remarks EMPLOYEE_ID NUMBER NOT NULL, Primary Key EMP_NAME VARCHAR2 (30) JOB_ID VARCHAR2 (20) SALARY NUMBER MGR_ID NUMBER References EMPLOYEE_ID COLUMN DEPARTMENT ID NUMBER Foreign key to DEPARTMENT ID column of the DEPARTMENTS table DEPARTMENTSColumn name Data type Remarks DEPARTMENT_ID NUMBER NOT NULL, Primary Key DEPARTMENT_NAME VARCHAR2(30) MGR_ID NUMBER References MGR_ID column of the EMPLOYEES table Evaluate this SQL statement: SELECT employee_id, e.department_id, department_name, salary FROM employees e, departments d WHERE e. department_id = d.department_id; Which SQL statement is equivalent to the above SQL statement? ()

  • A、SELECT employee_id, department_id, department_name, salary FROM employees WHERE department_id IN (SELECT department_id FROM departments);
  • B、SELECT employee_id, department_id, department_name, salary FROM employees NATURAL JOIN departments;
  • C、SELECT employee_id, d.department_id, department_name, salary FROM employees e JOIN departments d ON e.department _ id = d. department_id;
  • D、SELECT employee_id, department_id, department_name, Salary FROM employees JOIN departments USING (e.department_id, d.department_id);

正确答案:C

第6题:

某企业的数据库系统中有如下所示的员工关系和仓库关系,每个仓库可有多名员工,但只有一名负责人。

员工关系(employee):

仓库关系(warehouse):

则创建仓库表结构的SQL语句为(58)。

A.CREATE TABLE (employee ID CHAR(2)NOTNULL UNIQUE, name CHAR(30)NOT NULL, address CHAR(40), principal ID CHAR(3));

B.CREATE warehouse(warehouse ID CHAR(2)PRIMARY KEY, name CHAR(30), address CHAR(40), principal ID CHAR(3));

C.CREATE TABLE warehouse(warehouse ID CHAR(2)PRIMARY KEY, name CHAR(30)NOT NULL, address CHAR(40), principal ID CHAR(3), FOREIGN KEY(principal ID)REFERENCES employee(employee ID));

D.CREATE TABIE warehouse(warehouse ID CHAR(2), name CHAR(30)NOT NULL, address CHAR(40), principal ID CHAR(3), PRIMARY REY(warehouse ID), FOREIGN KEY(employee ID)REFERENCES employee(employee ID));


正确答案:C

第7题:

Examine the data in the EMPLOYEES table. EMPLOYEES EMP_NAME DEPT_ID MGR_ID JOB_ID SALARY EMPLOYEE_ID 101 Smith 20 120 SA_REP 4000 102 Martin 10 105 CLERK 2500 103 Chris 20 120 IT_ADMIN 4200 104 John 30 108 HR_CLERK 2500 105 Diana 30 108 IT_ADMIN 5000 106 Smith 40 110 AD.ASST 3000 108 Jennifer 30 110 HR_DIR 6500 110 Bob 40 EK_DIR 8000 120 Revi 20 110 SA_DIR 6500 On the EMPLOYEES table, EMPLOYEE_ID is the primary key. MGR_ID is the ID of managers and refers to the EMPLOYEE_ID. The JOB_ID column is a NOT NULL column. Evaluate this DELETE statement: DELETE employee_id, salary, job_id FROM employees WHERE dept_id = 90; Why does the DELETE statement fail when you execute it?()

  • A、There is no row with dept_id 90 in the EMPLOYEES table.
  • B、You cannot delete the JOB_ID column because it is a NOT NULL column.
  • C、You cannot specify column names in the DELETE clause of the DELETE statement.
  • D、You cannot delete the EMPLOYEE_ID column because it is the primary key of the table.

正确答案:C

第8题:

Examine the data in the EMPLOYEES and DEPARTMENTS tables.EMPLOYEESLAST_NAME DEPARTMENT_ID SALARYGetz 10 3000Davis 20 1500Bill 20 2200Davis 30 5000Kochhar 5000DEPARTMENTSDEPARTMENT_ID DEPARTMENT_NAME10 Sales20 Marketing30 Accounts40 AdministrationYou want to retrieve all employees, whether or not they have matching departments in the departments table.Which query would you use?()

A. SELECT last_name, department_name FROM employees , departments(+);

B. SELECT last_name, department_name FROM employees JOIN departments(+);

C. SELECT last_name, department_name ON (e. department_ id = d. departments_id); FROM employees(+) e JOIN departments d

D. SELECT last_name, department_name FROM employees e RIGHT OUTER JOIN departments d ON (e.department_id = d.department_id);

E. SELECT last_name, department_name FROM employees(+) , departments ON (e. department _ id = d. department _id);

F. SELECT last_name, department_name FROM employees e LEFT OUTER JOIN departments d ON (e. department _ id = d. department _id);


参考答案:F

第9题:

EMPLOYEES and DEPARTMENTS data: EMPLOYEES DEMP_NAME DEPT_ID MGR_ID JOB_ID SALARY EMPLOYEE_I 101 Smith 20 120 SA_REP 4000 102 Martin 10 105 CLERK 2500 103 Chris 20 120 IT_ADMIN 4200 104 John 30 108 HR_CLERK 2500 105 Diana 30 108 IT_ADMIN 5000 106 Smith 40 110 AD_ASST 3000 108 Jennifer 30 110 HR_DIR 6500 110 Bob 40 EX_DIR 8000 120 Ravi 20 110 SA_DIR 6500 DEPARTMENTS DEPARTMENT_ID DEPARTMENT_NAME 10 Admin 20 Education 30 IT 40 Human Resources On the EMPLOYEES table, EMPLOYEE_ID is the primary key. MGR_ID is the ID managers and refers to the EMPLOYEE_ID. On the DEPARTMENTS table DEPARTMENT_ID is the primary key. Evaluate this UPDATE statement. UPDATE employees SET mgr_id = (SELECT mgr_id FROM employees WHERE dept_id= (SELECT department_id FROM departments WHERE department_name = 'Administration')), Salary = (SELECT salary FROM employees WHERE emp_name = 'Smith') WHERE job_id = 'IT_ADMIN'; What happens when the statement is executed?()

  • A、The statement executes successfully, leaves the manager ID as the existing value, and changes the salary to 4000 for the employees with ID 103 and 105.
  • B、The statement executes successfully, changes the manager ID to NULL, and changes the salary to 4000 for the employees with ID 103 and 105.
  • C、The statement executes successfully, changes the manager ID to NULL, and changes the salary to 3000 for the employees with ID 103 and 105.
  • D、The statement fails because there is more than one row matching the employee name Smith.
  • E、The statement fails because there is more than one row matching the IT_ADMIN job ID in the EMPLOYEES table.
  • F、The statement fails because there is no 'Administration' department in the DEPARTMENTS table.

正确答案:D

第10题:

Examine the data in the EMPLOYEES and DEPARTMENTS tables: EMPLOYEES EMP_NAME DEPT_ID MGR_ID JOB_ID SALARY EMPLOYEE_ID 101 Smith 20 120 SA_REP 4000 102 Martin 10 105 CLERK 2500 103 Chris 20 120 IT_ADMIN 4200 104 John 30 108 HR_CLERK 2500 105 Diana 30 108 IT_ADMIN 5000 106 Smith 40 110 AD_ASST 3000 108 Jennifer 30 110 HR_DIR 6500 110 Bob 40 EX_DIR 8000 120 Ravi 20 110 SA*DIR 6500 DEPARTMENTS DEPARTMENT_ID DEPARTMENT_NAME 10 Admin 20 Education 30 IT 40 Human Resources Also examine the SQL statements that create the EMPLOYEES and DEPARTMENTS tables: CREATE TABLE departments (department_id NUMBER PRIMARY KEY, department _ name VARCHAR2(30)); CREATE TABLE employees (EMPLOYEE_ID NUMBER PRIMARY KEY, EMP_NAME VARCHAR2(20), DEPT_ID NUMBER REFERENCES departments(department_id), MGR_ID NUMBER REFERENCES employees(employee id), MGR_ID NUMBER REFERENCES employees(employee id), JOB_ID VARCHAR2(15). SALARY NUMBER); ON the EMPLOYEES, On the EMPLOYEES table, EMPLOYEE_ID is the primary key. MGR_ID is the ID of managers and refers to the EMPLOYEE_ID. DEPT_ID is foreign key to DEPARTMENT_ID column of the DEPARTMENTS table. On the DEPARTMENTS table, DEPARTMENT_ID is the primary key. Examine this DELETE statement: DELETE FROM departments WHERE department id = 40; What happens when you execute the DELETE statement?()

  • A、Only the row with department ID 40 is deleted in the DEPARTMENTS table.
  • B、The statement fails because there are child records in the EMPLOYEES table with department ID 40.
  • C、The row with department ID 40 is deleted in the DEPARTMENTS table. Also the rows with employee IDs 110 and 106 are deleted from the EMPLOYEES table.
  • D、The row with department ID 40 is deleted in the DEPARTMENTS table. Also the rows with employee IDs 106 and 110 and the employees working under employee 110 are deleted from the EMPLOYEES table.
  • E、The row with department ID 40 is deleted in the DEPARTMENTS table. Also all the rows in the EMPLOYEES table are deleted.
  • F、The statement fails because there are no columns specifies in the DELETE clause of the DELETE statement.

正确答案:B

更多相关问题