Sql Certificate 简明教程

SQL - The SQL SELECT Statement Questions

1. Identify the capabilities of SELECT statement.

1. Identify the capabilities of SELECT statement.

Answer: A, B. SELECT 语句可用于选择、投影和联接。

Answer: A, B. The SELECT statement can be used for selection, projection and joining.

2. Determine the capability of the SELECT statement demonstrated in the given query.

2. Determine the capability of the SELECT statement demonstrated in the given query.

SELECT e.ename, d.dname
FROM   emp e, dept d
WHERE  e.deptno = d.deptno
AND    e.sal > 1000;

Answer: A, C, D. 投影是仅在查询中包含所需列,而选择是仅选择所需数据。联接是指通过连接列将两张表组合在一起。

Answer: A, C, D. Projection is including only the required columns in query, while Selection is selecting only the required data. Joining means combining two tables together through a connecting column.

3. Which of the following clause is used to suppress duplicates in a SELECT statement?

3. Which of the following clause is used to suppress duplicates in a SELECT statement?

Answer: C, D. 重复数据可以使用 SELECT 语句中的 DISTINCT 或 UNIQUE 进行限制。

Answer: C, D. Duplicate data can be restricted with the use of DISTINCT or UNIQUE in the SELECT statement.

4. Chose the statements which correctly specify a rule to write a SQL statement

4. Chose the statements which correctly specify a rule to write a SQL statement

答案:C. SQL 语句不区分大小写。

*Answer: C.*SQL statements are not case sensitive.

5. Determine the output of the below query -

5. Determine the output of the below query -

SELECT '5+7'
FROM dual;

答案:B. Oracle 将双引号内的值视为字符串表达式。

*Answer: B.*Oracle treats the values within double quotes as string expressions.

6. Write a query to display employee details (Name, Department, Salary and Job) from EMP table.

6. Write a query to display employee details (Name, Department, Salary and Job) from EMP table.

答案 A. 从表格中选择需要的内容,它们之间用逗号分隔。

*Answer A.*Select the required from the tables each separated by a comma.

7. Which of the below queries displays employees' name and new salary after the increment of 1000?

7. Which of the below queries displays employees' name and new salary after the increment of 1000?

*答案:C. * 可以在 SELECT 语句中使用列来进行基本的算术计算。

*Answer: C. *Basic arithmetic calculations can be done using the columns in SELECT statements.

8. Determine the output of the below query

8. Determine the output of the below query

SELECT 36/2-5*10 FROM dual;

*答案:B. * 乘法和除法先于加法和减法运算。

*Answer: B. *Multiplication and Division occur before addition and subtraction.

9. Determine the output of the below query

9. Determine the output of the below query

SELECT (100-25)/15*(20-3) FROM dual;

*答案:D. * 括号内的表达式会先于表达式中的除法和乘法运算执行。

*Answer: D. *Expression within the brackets are executed before the divisions and multiplications in the expression.

10. Chose the statements which correctly define a NULL value.

10. Chose the statements which correctly define a NULL value.

答案:B, D. NULL 表示无值,但它既不等于零,也不等于空白或空格字符。

*Answer: B, D.*NULL is NO VALUE but neither same as zero nor as blank or space character.

11. Determine the output of the below query

11. Determine the output of the below query

SELECT sal + NULL
FROM emp
WHERE empno = 7369;

*答案:B. * 任何带有 NULL 的算术运算结果都是 NULL。

*Answer: B. *Any arithmetic operation with NULL results in NULL.

12. Which of the below statements define column alias correctly?

12. Which of the below statements define column alias correctly?

*答案:A, D. * 列别名可用于在 SELECT 语句中为表达式命名。

*Answer: A, D. *Column Alias can be used to name an expression in the SELECT statement.

13. Specify the column alias NEWSAL for the expression containing salary in the below SQL query

13. Specify the column alias NEWSAL for the expression containing salary in the below SQL query

SELECT ename, job, sal + 100 FROM emp;

*答案:A,B。*使用“AS”表示列表达式的别名。

*Answer: A, B.*Use 'AS' to signify new alias to a column expression.

14. Specify the column alias "New Salary" for the expression containing salary in the below SQL query

14. Specify the column alias "New Salary" for the expression containing salary in the below SQL query

SELECT ename, job, sal + 100 FROM emp;

*答案:B,D。*带有空格和特殊字符的列别名必须用双引号引起来。

*Answer: B, D. *Column alias with space and special characters must be enquoted within double quotes.

15. Which command is used to display the structure of a table?

15. Which command is used to display the structure of a table?

*答案:C。*DESCRIBE用于显示表结构。

*Answer: C.*DESCRIBE is used to show the table structure.

16. Predict the output when below statement is executed in SQL Plus?*

16. Predict the output when below statement is executed in SQL Plus?*

DESC emp

*答案:C。*DESCRIBE用于显示表结构以及表列、其数据类型和空值。

*Answer: C. *DESCRIBE is used to show the table structure along with table columns, their data type and nullity

17. Which of the below statements are true about the DESCRIBE command?

17. Which of the below statements are true about the DESCRIBE command?

Answer: B.

Answer: B.

18. Which of the below alphanumeric characters are used to signify concatenation operator in SQL?

18. Which of the below alphanumeric characters are used to signify concatenation operator in SQL?

*答案:B。*在SQL中,连接运算符用两个竖线(||)表示。

*Answer: B.*In SQL, concatenation operator is represented by two vertical bars (||).

19. Which of the below statements are correct about the usage of concatenation operator in SQL?

19. Which of the below statements are correct about the usage of concatenation operator in SQL?

*答案:B,D。*连接运算符将两个值连接为一个表达式。

*Answer: B, D. *Concatenation operator joins two values as an expression.

20. Predict the output of the below query

20. Predict the output of the below query

SELECT ename || NULL
FROM emp
WHERE empno = 7369

*答案:A。*与NULL连接会得到相同的值。

*Answer: A. *Concatenation with NULL results into same value.

21. Predict the output of the below query

21. Predict the output of the below query

SELECT 50 || 0001
FROM dual

*答案:C。*Oracle会忽略表达式右操作数中的前导零。

*Answer: C. *The leading zeroes in the right operand of expression are ignored by Oracle.

22. You execute the below query

22. You execute the below query

SELECT e.ename||' departments's name is:'|| d.dname
FROM emp e, dept d
where e.deptno=d.deptno;

And get the exception - ORA-01756: quoted string not properly terminated. Which of the following solutions can permanently resolve the problem?

And get the exception - ORA-01756: quoted string not properly terminated. Which of the following solutions can permanently resolve the problem?

答案:B。[q]运算符用于用引号引起字符字面量。

*Answer: B. *The [q] operator is used to enquote character literals with a quote.

23. Which of the below SELECT statement shows the correct usage of [q] operator?

23. Which of the below SELECT statement shows the correct usage of [q] operator?

Answer: A

Answer: A

24. Which of the below SELECT statement is used to select all columns of EMP table?

24. Which of the below SELECT statement is used to select all columns of EMP table?

Answer: C. *The character ' ' 用于选择表的全部列。

Answer: C. *The character '' is used to select all the columns of the table.

25. Which of the below SQL query will display employee names, department, and annual salary?

25. Which of the below SQL query will display employee names, department, and annual salary?

*答案:C. *在 SELECT 语句中使用数值表达式执行基本的算术计算。

*Answer: C. *Use numeric expressions in SELECT statement to perform basic arithmetic calculations.