nerdexam
Exams312-50V10Questions#342
EC-Council

312-50V10 · Question #342

312-50V10 Question #342: Real Exam Question with Answer & Explanation

The correct answer is A: --. In SQL, a double hyphen (--) begins a single-line comment, causing the database engine to ignore everything after it on that line.

Question

Which of the following is used to indicate a single-line comment in structured query language (SQL)?

Options

  • A--
  • B||
  • C%%
  • D''

Explanation

In SQL, a double hyphen (--) begins a single-line comment, causing the database engine to ignore everything after it on that line.

Common mistakes.

  • B. || is the standard SQL string concatenation operator (used in Oracle, PostgreSQL, and ANSI SQL) and has no comment-related function.
  • C. %% is not valid SQL syntax; a single % is used as a wildcard character within LIKE predicate patterns, not for comments.
  • D. '' represents an empty string literal in SQL and has no comment functionality.

Concept tested. SQL single-line comment syntax and injection

Reference. https://learn.microsoft.com/en-us/sql/t-sql/language-elements/comment-transact-sql

Community Discussion

No community discussion yet for this question.

Full 312-50V10 Practice
Which of the following is used to indicate a single-line comment... | 312-50V10 Q#342 Answer | NerdExam