Sql Certificate 简明教程
SQL - Restricting and Sorting Data Questions
1. Which of the following clause is used to limit the number of rows retrieved from a SELECT query?
1. Which of the following clause is used to limit the number of rows retrieved from a SELECT query?
Answer: B. WHERE 子句用于限制 SELECT 查询返回的行数。
Answer: B. The WHERE clause is used to restrict the number of rows returned from a SELECT query.
2. Choose the database elements whose values can be compared in a WHERE clause of a SELECT query.
2. Choose the database elements whose values can be compared in a WHERE clause of a SELECT query.
*答案:A、D。*WHERE 子句可用于比较列、字面值、算术运算和函数中的值。
*Answer: A, D. *The WHERE clause can be used to compare the values from columns, literals, arithmetic functions and functions.
3. What are the elements NOT contained in the WHERE clause predicate of the SELECT query?
3. What are the elements NOT contained in the WHERE clause predicate of the SELECT query?
*答案:D。*WHERE 子句谓词中不需要表名。
*Answer: D. *Table Name is not required in the WHERE clause predicate.
4. Which of the following values can NOT be returned after evaluation of WHERE clause condition?
4. Which of the following values can NOT be returned after evaluation of WHERE clause condition?
*答案:A。*如果不知道 WHERE 子句中条件的结果,则返回 NULL。在所有其他情况下,返回 TRUE 或 FALSE。
*Answer: A. *If the result of the condition in WHERE clause is not known, NULL is returned. In all other scenarios, either TRUE or FALSE is returned.
5. What is the minimum number of WHERE clauses that must be present in a SELECT query?
5. What is the minimum number of WHERE clauses that must be present in a SELECT query?
*答案:C。*WHERE 子句是 SELECT 查询中的可选子句,仅用于限制行数。
*Answer: C. *The WHERE clause is an optional clause in the SELECT query which is only used to restrict the number of rows.
6. What is the maximum number of WHERE clauses that can be included in a SELECT query?
6. What is the maximum number of WHERE clauses that can be included in a SELECT query?
*答案:A。*WHERE 子句是 SELECT 查询中的可选子句,只能使用一次来限制行数。
*Answer: A. *The WHERE clause is an optional clause in the SELECT query which can be used only once to restrict the number of rows.
7. Which of the following statements are correct about the WHERE clause?
7. Which of the following statements are correct about the WHERE clause?
*答案:C。*WHERE 子句必须具有用于计算条件的比较运算符。它可以使用函数作为其中一个运算数。在一个 SELECT 查询中只允许使用一个 WHERE 子句。
*Answer: C. *The WHERE clause must have comparison operator to evaluate the condition. It can use function as one of the operand. Only one WHERE clause is allowed in a SELECT query.
8. Write a SELECT query to list down unique departments from EMP table?
8. Write a SELECT query to list down unique departments from EMP table?
Answer: B & C. DISTINCT 关键字用于过滤出 SELECT 查询中的重复行。
Answer: B & C. The keyword DISTINCT is used to filter out the duplicate rows from the SELECT query.
9. Which of the following operations are permitted for date and timestamp columns?
9. Which of the following operations are permitted for date and timestamp columns?
*答案:B、C 和 D。*加、减和连接是允许用于日期和时间戳列的操作。
*Answer: B, C, and D. *Addition, subtraction and Concatenation are the operations permitted for date and timestamp columns.
10. From the below operators, which one of them holds the highest precedence level?
10. From the below operators, which one of them holds the highest precedence level?
Answer: C. 括号内的表达式具有优先级最高的级别。
Answer: C. Expressions within the brackets hold the highest precedence level.
11. Interpret the output returned by the below SELECT query
11. Interpret the output returned by the below SELECT query
SELECT ename, (sysdate - hiredate)
FROM emp;
*答案:C。*表达式 (sysdate-hiredate) 返回员工在公司中的任职天数。
*Answer: C. *The expression (sysdate-hiredate) returns the number of employment days of an employee with the company.
12. Which of the below statements correctly describle the DUAL table in Oracle?
12. Which of the below statements correctly describle the DUAL table in Oracle?
*答案:B、C、D。*Oracle 中的 DUAL 表由 SYS 拥有,并包含一个类型为 VARCHAR2(1) 的列 DUMMY。
*Answer: B, C, D. *The DUAL table in Oracle is owned by SYS and contains one column DUMMY of type VARCHAR2(1).
13. Determine the type of output returned by the below query
13. Determine the type of output returned by the below query
SELECT sysdate - hiredate
FROM emp
WHERE empno=7369;
*答案:B。*两个日期之间的减法得出两个日期之间的数字日期差
*Answer: B. *Subtraction between two dates results in numeric difference of days between the two dates
14. Which expressions do NOT return NULL values?
14. Which expressions do NOT return NULL values?
Answer: B, D. 任何用 NULL 进行的算术运算都会得到 NULL。
Answer: B, D. Any arithmetic operation with NULL results in NULL.
15. Determine the output of the below query
15. Determine the output of the below query
SELECT 'Tutorial''s Point compiles technical tutorials' FROM DUAL;
回答:B。
*Answer: B. *
16. Examine the TRAINING table as given below:
16. Examine the TRAINING table as given below:
Name Null? Type
----------------------------------------- -------- -------------
TRAINING_ID NOT NULL NUMBER(5)
TRAINING_LOCATION NUMBER(7,2)
START_DATE DATE
END_DATE DATE
Answer: A, D. 在 NULL 时使用 NVL 函数向列提供备用值。
Answer: A, D. Use NVL function to provide an alternate value to a column when NULL.
17. What does the selection of columns in a SELECT statement known as?
17. What does the selection of columns in a SELECT statement known as?
Answer: C. 投影是仅在 SELECT 语句中选择所需列的能力。
Answer: C. Projection is the ability to select only the required columns in SELECT statement.
18. What does the restriction of rows returned by a SELECT statement known as
18. What does the restriction of rows returned by a SELECT statement known as
Answer: C. 限制是指通过设置特定条件来限制行数的能力。
Answer: C. Restricting is the ability to limit the number of rows by putting certain conditions.
19. Which of the following is true about the query given below?
19. Which of the following is true about the query given below?
SELECT col1, col2
FROM tab1
ORDER BY col1;
Answer: B. 默认情况下,ORDER BY 子句按升序对值进行排序。
Answer: B. By default, the ORDER BY clause sorts the values in ascending order.
20. Which of the following is true about the SQL query given below?
20. Which of the following is true about the SQL query given below?
SELECT col1,col2
FROM tab1
WHERE col1 = 'A'
ORDER BY col2 DESC, col1;
*答案:C。*由于 COL1 已经在查询中作为标量值进行了筛选和固定,因此不会根据 COL1 进行排序。
*Answer: C. * Since the COL1 is already filtered and fixed in the query as a scalar value, no sorting will happen on the basis of COL1.
21. What is true regarding the query given below?
21. What is true regarding the query given below?
SELECT col1, col2
FROM tab1
ORDER BY col1,col2
WHERE col2 = 'B';
Answer: D. ORDER BY 子句必须出现在 SELECT 语句中的 WHERE 子句之后
Answer: D. The ORDER BY clause must appear after the WHERE clause in the SELECT statement
22. Which two clauses of the SELECT statement are necessary for Selection and Projection?
22. Which two clauses of the SELECT statement are necessary for Selection and Projection?
Answer: C.
Answer: C.
23. Which of the following WHERE clauses will NOT fit in the below SELECT query?
23. Which of the following WHERE clauses will NOT fit in the below SELECT query?
SELECT ename, deptno, sal
FROM emp;
*答案:C。*字符文本必须用单引号引起来
*Answer: C. *Character literals must be enclosed within single quotes
24. Choose the WHERE clause that extracts the DNAME values containing the character literal “er” from the DEPT table.
24. Choose the WHERE clause that extracts the DNAME values containing the character literal “er” from the DEPT table.
答案:B. LIKE 运算符用于在 SQL 查询中执行通配符搜索。
*Answer: B. *The LIKE operator is used to perform wild card search in SQL queries.
25. Which two of the following conditions are equivalent to each other?
25. Which two of the following conditions are equivalent to each other?
答案:A,D. NOT 运算符可用来否定其操作数的影响。因此 (COMM IS NULL) 等效于 (NOT (COMM IS NOT NULL)).
*Answer: A, D. * The NOT operator can be used to negate the effect of its operand. Therefore (COMM IS NULL) is equivalent to (NOT (COMM IS NOT NULL)).
26. Which of the following clauses are mandatory in an SQL query?
26. Which of the following clauses are mandatory in an SQL query?
Answer: A. SELECT 和 from 是 SELECT 查询中的强制性子句。
Answer: A. SELECT and FROM are the mandatory clauses in a SELECT query.
27. Which three of the following WHERE clause conditions are equivalent to each other?
27. Which three of the following WHERE clause conditions are equivalent to each other?
Answer: A, C, D. 可以使用 IN、BETWEEN 和关系运算符使条件等效
Answer: A, C, D. The conditions can be made equivalent with the use of IN, BETWEEN and relational operators
28. Which of the following is true with respect to the below query?
28. Which of the following is true with respect to the below query?
SELECT empno, ename, job
FROM emp
WHERE ename like '_ith%';
*回答:D. *
*Answer: D. *
29. Which of the following is used to end a SQL query?
29. Which of the following is used to end a SQL query?
Answer: B, D. 在 SQL*Plus 和 SQL Developer 中,使用分号 (;) 或反斜杠 (/) 来终止查询。
Answer: B, D. A semicolon (;) or backslash (/) is used to terminate a query in SQL* Plus and SQL Developer.
30. The employees JAMES and MILLER want to know their department id by querying the database. Which of the following queries will give the required result?
30. The employees JAMES and MILLER want to know their department id by querying the database. Which of the following queries will give the required result?
Answer: D. 可以使用 OR 子句连接多个条件。如果两个条件中任何一个为真,则查询执行成功。
Answer: D. Multiple conditions can be joined using OR clause. Query execution is successful if either of the two is true.
31. Which of the following is false regarding the WHERE clause?
31. Which of the following is false regarding the WHERE clause?
Answer: C, D.
Answer: C, D.
32. What is the default date format in Oracle?
32. What is the default date format in Oracle?
答案:D. DD-MON-RR 是 Oracle 中的默认日期格式。
*Answer: D. * DD-MON-RR is the default date format in Oracle.
33. Predict the output of the below SQL query.
33. Predict the output of the below SQL query.
SELECT ename, deptno, sal, comm
FROM emp
WHERE job = 'SALES'
AND hiredate = ”01-JAN-97”;
答案:B. 日期文本必须用单引号引起来。
*Answer: B. *Date literals must be enclosed within single quotes.
34. You need to display the names of all the employees having the first name as "GARRY" from the EMPLOYEES table. Which of the following queries will fulfill the requirement?
34. You need to display the names of all the employees having the first name as "GARRY" from the EMPLOYEES table. Which of the following queries will fulfill the requirement?
Answer: C. 如果搜索字符串的某些字符未知,可以使用通配符。
Answer: C. Wild Cards can be used if certain characters of the search string are unknown.
35. You need to display the employee ID of all the employees who contain a letter 's' in their last name at second position and department ID as 100. Which of the following queries will fetch the required results?
35. You need to display the employee ID of all the employees who contain a letter 's' in their last name at second position and department ID as 100. Which of the following queries will fetch the required results?
Answer: D. 通配符下划线 (_) 用于替换单个字符。
Answer: D. The wildcard character underscore (_) is used to substitute a single character.
36. What will be the outcome of the below query?
36. What will be the outcome of the below query?
SELECT first_name, last_name, dept_id
FROM employees
WHERE hire_date LIKE '%98';
Answer: D. LIKE 运算符用于对字符和日期文字执行通配符搜索。
Answer: D. The LIKE operator is used to perform wild card search on character and date literals.
37. Which of the following is used to get rows based on a range of values?
37. Which of the following is used to get rows based on a range of values?
Answer: C. BETWEEN 运算符用于基于值范围检索行。
Answer: C. The BETWEEN operator is used to retrieve rows based on range of values.
38. You need to display the employee IDs of the employees who have their salaries between 20000 (inclusive) and 50000(inclusive). Which of the following queries will fetch the required results?
38. You need to display the employee IDs of the employees who have their salaries between 20000 (inclusive) and 50000(inclusive). Which of the following queries will fetch the required results?
*答案:A、D。*对于较大的值范围,BETWEEN 和关系运算符最适合在查询中使用。不建议将 IN 运算符用于较大的值范围。
*Answer: A, D. *For larger ranges of values, BETWEEN and relational operators are best suited in the queries. IN operator is not recommended for large range of values.
39. What is true with respect to the below query?
39. What is true with respect to the below query?
SELECT first_name, last_name
FROM employees
WHERE last_name BETWEEN 'B%' AND 'E%';
*答案:A。*BETWEEN 运算符也可以使用字符值范围。
*Answer: A. *The BETWEEN operator works with the range of character values also.
40. What will be the outcome of the query mentioned below?
40. What will be the outcome of the query mentioned below?
SELECT employee_id, last_name, first_name, salary, manager_id
FROM employees
WHERE manager_id IN (200,100,300);
Answer: B. IN 运算符可用于提供范围小且数量有限的范围。
Answer: B. The IN operator can be used to provide small and limited number of range.
41. Which of the following clause defines a Membership condition?
41. Which of the following clause defines a Membership condition?
*答案:D。*IN 运算符定义了一个成员资格条件,该条件可以使用值范围或子查询。
*Answer: D. * The IN operator defines a Membership condition which may use a range of values or a subquery.
42. Which of the following data types can be used within IN operator?
42. Which of the following data types can be used within IN operator?
*答案:D。*IN 运算符适用于所有类型的值。
*Answer: D. *The IN operator works with all types of values.
43. You need to display the list of all the employees whose first name starts with “Bryan” or “Jason”. Which of the following queries will fulfill the requirement?
43. You need to display the list of all the employees whose first name starts with “Bryan” or “Jason”. Which of the following queries will fulfill the requirement?
Answer: C, D. IN 运算符检查定义为成员资格条件的任意值。
Answer: C, D. The IN operator checks for ANY values defined as membership condition.
44. You need to extract details of those departments whose name contains the string '_DXX'. Which of the below WHERE clauses could be used in the SELECT statement to get the required output?
44. You need to extract details of those departments whose name contains the string '_DXX'. Which of the below WHERE clauses could be used in the SELECT statement to get the required output?
Answer: B.
Answer: B.
45. Which statement is true regarding the default behavior of the ORDER BY clause?
45. Which statement is true regarding the default behavior of the ORDER BY clause?
Answer: A. ORDER BY 子句对字符值进行大小写敏感排序。
Answer: A. The ORDER BY clause does a case sensitive sorting with character values.
46. You need to generate a report of all employees from the EMPLOYEES table based on the following conditions: 1. The Employee first name should not begin with 'T' or 'N'. 2. The Employee’s salary should be more than 20000. 3. The Employee should have been hired after 1st January 2010. Which WHERE clause would give the required result?
46. You need to generate a report of all employees from the EMPLOYEES table based on the following conditions: 1. The Employee first name should not begin with 'T' or 'N'. 2. The Employee’s salary should be more than 20000. 3. The Employee should have been hired after 1st January 2010. Which WHERE clause would give the required result?
回答:C。
*Answer: C. *
47. Using the EMPLOYEES table, you need to display the names of all employees hired after January 1, 2013, starting with the freshers. Which query would give the required result? (Choose all that apply.)
47. Using the EMPLOYEES table, you need to display the names of all employees hired after January 1, 2013, starting with the freshers. Which query would give the required result? (Choose all that apply.)
Answer: A, D.
Answer: A, D.
48. Using the EMPLOYEES table, you need to find out the names and salaries of all the employees hired in departments 100 and 101 in the time interval 15th March '12 to 15th October '13. Which two queries would give the required result? (Choose two.)
48. Using the EMPLOYEES table, you need to find out the names and salaries of all the employees hired in departments 100 and 101 in the time interval 15th March '12 to 15th October '13. Which two queries would give the required result? (Choose two.)
*答案:A,D. *
*Answer: A, D. *
49. Using the EMPLOYEES table, you issue the following query to generate the names, current salary and the salary increased after an appraisal by 25%. The increased salary for all the employees should be above 30000.
49. Using the EMPLOYEES table, you issue the following query to generate the names, current salary and the salary increased after an appraisal by 25%. The increased salary for all the employees should be above 30000.
SELECT first_name, salary,
salary + (salary *0.25) "INCREASED_SALARY"
FROM employees
WHERE increased_salary >30000;
查询抛出错误 ORA-00904。错误的原因是什么?
The query throws an error ORA-00904. What is the reason for the error?
*答案:C*列别名不能用于 WHERE 子句条件,但可以用于 SELECT 语句和 ORDER BY 子句。
*Answer: C. *A column alias cannot be used in WHERE clause conditions but can be used in SELECT statement and ORDER BY clause.
50. You need to display employee names from the EMPLOYEES table that belong to the Department id 100 with minimum salary as either 2000 or 4000 and no job_id. You issue the following query.
50. You need to display employee names from the EMPLOYEES table that belong to the Department id 100 with minimum salary as either 2000 or 4000 and no job_id. You issue the following query.
SELECT first_name, dept_id, salary
FROM employees
WHERE dept_id = 100 AND (salary = 2000 OR salary = 4000)
AND job_id <> '';
Which statement is true regarding the above query?
Which statement is true regarding the above query?
*答案:A*条件 (salary = 2000 OR salary = 4000) 导致 FALSE,因为一个员工不能同时持有多项薪资。
*Answer: A. *The condition (salary = 2000 OR salary = 4000) results in FALSE because an employee cannot held multiple salaries at a time.
51. Which three tasks can be performed using SQL functions built into Oracle Database? (Choose three.)
51. Which three tasks can be performed using SQL functions built into Oracle Database? (Choose three.)
*答案:A、B、C*使用格式化函数 (TO_CHAR、TO_DATE) 和字符函数 (LENGTH、REPLACE) 来实现目标。
*Answer: A, B, C. *Use formatting functions (TO_CHAR, TO_DATE), and character functions (LENGTH, REPLACE) to achieve the objectives.
52. You need to generate a report that displays the IDs of all employees in the EMPLOYEES table whose salary is at least 25% more than the value 20000. The details should be displayed in the descending order of the salary. You issue the following query.
52. You need to generate a report that displays the IDs of all employees in the EMPLOYEES table whose salary is at least 25% more than the value 20000. The details should be displayed in the descending order of the salary. You issue the following query.
SELECT emp_id
FROM employees
WHERE salary>=20000*0.25
ORDER BY salary*0.25 DESC;
Which statement is true regarding the above query?
Which statement is true regarding the above query?
*答案:A*ORDER BY 子句可以包含列表达式。
*Answer: A. *The ORDER BY clause can contain column expressions.
53. Examine the structure and data of the TRAININGS table:
53. Examine the structure and data of the TRAININGS table:
Name Null? Type
----------------------------------------- -------- -------------
TRAINING_ID NOT NULL NUMBER(5)
TRAINING_LOCATION NUMBER(7,2)
START_DATE DATE
END_DATE DATE
TRAINING_ID START_DATE TRAINING_COST
------ ---------------- -------------------------------------------------
11 01-JAN-10 1000
22 01-FEB-10 2000
33 01-MAR-10 3000
Dates are stored in the default date format dd-mon-rr in the TRAININGS table. Which three SQL statements would execute successfully? (Choose three.)
Dates are stored in the default date format dd-mon-rr in the TRAININGS table. Which three SQL statements would execute successfully? (Choose three.)
Answer: A, C, D.
Answer: A, C, D.
54. Which of the following statements is/are true with respect to the below query?
54. Which of the following statements is/are true with respect to the below query?
SELECT emp_id, first_name
FROM employees
ORDER BY dept_id;
Answer: C. ORDER BY 子句可以使用不在列列表中选择的一列来对数据进行排序,但包含在 FROM 子句中使用的表中。
Answer: C. The ORDER BY clause can use a column to sort the data which is not selected in the column list but is contained in the table used in FROM clause.
55. Which feature of ORDER BY clause is demonstrated in the below query?
55. Which feature of ORDER BY clause is demonstrated in the below query?
SELECT emp_id, first_name “EmpName”
FROM employees
ORDER BY "EmpName";
*回答:C. *ORDER BY 子句与 SELECT 语句中使用的列别名配合良好。
*Answer: C. *The ORDER BY clauses works fine with the column aliases used in SELECT statement.
56. What is true about the query given below?
56. What is true about the query given below?
SELECT last_name, job_id, department_id, hire_date
FROM employees
ORDER BY 2;
Answer: A. 数值位置的列可以在 ORDER BY 子句中使用。
Answer: A. Numeric position of the column can be used in the ORDER BY clause.
57. You need to list the employees details for different jobs but only one at a time.
57. You need to list the employees details for different jobs but only one at a time.
SELECT emp_id, first_name, last_name FROM employees WHERE job_id....;
Which of the following is an easier way to achieve the same in SQL 加号?*
Which of the following is an easier way to achieve the same in SQL Plus?*
Answer: C. &X 符号暂停查询执行,并在每次执行查询时提示用户输入。
Answer: C. The &X notation haults the query execution and prompts for user input every time the query is executed.
58. Which of the following statements is true regarding substitution variables in SQL?
58. Which of the following statements is true regarding substitution variables in SQL?
答案:A。
*Answer: A. *
59. Which of the following data type is assigned to Substitution variables?
59. Which of the following data type is assigned to Substitution variables?
*回答:C. *替代变量本身没有数据类型,但遵守与它们一起使用的列的数据类型。
*Answer: C. * Substitution variables do not have the data type of their own but comply with the column’s data type with whom they are used.
60. Which among the following is true about substitution variables?
60. Which among the following is true about substitution variables?
*回答:D. *
*Answer: D. *
61. Which of the following is a correct syntax for Substitution variables in SQL 加号?*
61. Which of the following is a correct syntax for Substitution variables in SQL Plus?*
Answer: C, D.
Answer: C, D.
62. Which of the following Substitution variables will take the entered value once and then keeps it for the rest of the session?
62. Which of the following Substitution variables will take the entered value once and then keeps it for the rest of the session?
*回答:A. *具有双连字符的替代变量重复使用用户提供的值一次。
*Answer: A. *A substitution variable with double ampersand repeatedly uses the value once provided by the user.
63. Which of the following is true about substitution variables?
63. Which of the following is true about substitution variables?
回答:C。
*Answer: C. *
64. What is true about the query given below?
64. What is true about the query given below?
SELECT first_name, last_name, employee_id, salary
FROM employees
WHERE employee_id = &eid;
答案:B、D。
*Answer: B, D. *
65. Choose the statements which hold true about the query given below.
65. Choose the statements which hold true about the query given below.
SELECT first_name, last_name, &&prompt_col
FROM employees
ORDER BY &&promp_col;
Answer: D. 可以在 SQL 查询的所有子句中使用替换变量。
Answer: D. A substitution variable can be used in all the clauses of SQL query.
66. Which of the following commands is used to create and assign a value to a substitution variable in SQL 加号?*
66. Which of the following commands is used to create and assign a value to a substitution variable in SQL Plus?*
Answer: D. 在 SQL*Plus 中使用 DEFINE 命令在会话中声明替换变量。
Answer: D. Use DEFINE command in SQL* Plus to declare a substitution variable in a session.
67. What will be the outcome of the below activity in SQL 加号?*
67. What will be the outcome of the below activity in SQL Plus?*
DEFINE eid = 117
SELECT first_name, last_name, employee_id, salary
FROM employees
WHERE employee_id = &eid;
回答:C。
*Answer: C. *
68. What is the command to remove the value of the substitution variable set by the command DEFINE?
68. What is the command to remove the value of the substitution variable set by the command DEFINE?
*答案:A。*使用 UNDEFINE 命令从会话中删除替换变量
*Answer: A. *Use UNDEFINE command to delete a substitution variable from the session
69. Which of the following commands is used to check the substitution variables values before and after execution of an SQL query?
69. Which of the following commands is used to check the substitution variables values before and after execution of an SQL query?
*答案:D。*在 SQL*Plus 和 SQL Developer 中使用 VERIFY 命令检查使用替换变量替换值。
*Answer: D.*Use VERIFY command in SQL*Plus and SQL Developer to check the substitution of values using substitution variables.
70. Which of the following are valid operators for the WHERE clause?
70. Which of the following are valid operators for the WHERE clause?
答案:A、B、C。
*Answer: A, B, C. *
71. Evaluate the following query:
71. Evaluate the following query:
SELECT ename || q'{'s salary is }' || sal
AS "Salary"
FROM emp;
Answer: C.
Answer: C.
72. Which of the below WHERE clause predicates will correctly list the employees from department 20?
72. Which of the below WHERE clause predicates will correctly list the employees from department 20?
Answer: C, D. 等于运算符 (=) 用于比较条件中运算式的相等性。
Answer: C, D. The equality operator (=) is used to compare the operands in the condition for equality.
73. Write a SELECT query to list the employees whose salary is greater than 1000.
73. Write a SELECT query to list the employees whose salary is greater than 1000.
Answer: B. 大于运算符 (>) 用于比较条件中的运算式。
Answer: B. The greater than operator (>) is used to compare the operands in the condition.
74. What would happen when the below query is executed in SQL 更妙的是?*
74. What would happen when the below query is executed in SQL Plus?*
SELECT ename, sal, deptno
FROM emp
WHERE sal/10 > deptno*10;
Answer: A. WHERE 子句可以包含表达式。
Answer: A. The WHERE clause can contain expressions.
75. Determine the error in the below SELECT statement
75. Determine the error in the below SELECT statement
SELECT ename, deptno, sal
FROM emp
WHERE job=CLERK;
Answer: B. 字符串文字必须用单引号括起来
Answer: B. Character literals must be enclosed within single quotes
76. Interpret the output of the below SQL query
76. Interpret the output of the below SQL query
SELECT ename, deptno, sal
FROM emp
WHERE sysdate-hiredate > 100;
Answer: A, B. 日期表达式可用于 WHERE 子句
Answer: A, B. Dates expressions can be used in WHERE clause
77. Which of the following query will display the employees which are hired after 31st Decemeber, 1982?
77. Which of the following query will display the employees which are hired after 31st Decemeber, 1982?
Answer: A, B. 日期文字必须用单引号括起来。
Answer: A, B. Date literals must be enclosed within single quotes.
78. Which of the following WHERE conditions will list employees who were hired on current date?
78. Which of the following WHERE conditions will list employees who were hired on current date?
Answer: C, D. 条件 SYSDATE=HIREDATE 将不起作用,因为 SYSDATE 包含动态时间戳组件,而 hiredate 是数据库中的静态值。
Answer: C, D. The condition SYSDATE=HIREDATE will not work because SYSDATE contains dynamic timestamp component while hiredate is a static value in the database.
79. What of the following are the valid formats of date literals which can be used in WHERE clause?
79. What of the following are the valid formats of date literals which can be used in WHERE clause?
Answer: A, C. 日期文字的默认格式为 DD-MON-RR。
Answer: A, C. Default format for date literals is DD-MON-RR.