Computer Knowledge

Database and SQL

4,213 Questions

Master structured query language commands, database joins, table constraints, and alias generation. This section covers relational database management concepts and query outputs essential for technical aptitude. These technical questions feature prominently in banking IT officer exams and computer knowledge sections.

SQL queries and aliasesDatabase table constraintsDatabase joins and transformationsStored procedures and functions

Database and SQL Questions

Multiple choice technology databases
  1. Stored Procedure Not Found

  2. General error

  3. Duplicate cursor name

  4. Option value changed

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

SQL470 indicates that an option value has changed, typically referring to database configuration options or settings that were modified during operation. This error occurs when the system detects a discrepancy between expected and actual option values. Options A, B, and C refer to different database error scenarios (missing procedures, general failures, cursor naming conflicts).

Multiple choice technology databases
  1. DDL not allowed on this table definition

  2. Column with this name already exists

  3. View's WITH CHECK OPTION validation failed in UPDATE

  4. One or more matching rows is locked by another user

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In SQL Anywhere and Sybase databases, the SQL300 error code indicates that DDL (Data Definition Language) operations are not allowed on the specified table definition.

Multiple choice technology databases
  1. Invalid field name

  2. Invalid table name

  3. Invalid index name

  4. Invalid view name

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

SQL87 specifically indicates an invalid table name error, meaning the SQL statement references a table that doesn't exist, is misspelled, or the user lacks permissions to access it. This is distinct from other object naming errors - options A, C, and D refer to fields, indexes, and views respectively, which would produce different error codes. The table name validation happens early in SQL parsing.

Multiple choice technology databases
  1. Cursor not updateable

  2. DISTINCT not valid in subquery of FROM clause

  3. Positive integer constant or variable expected

  4. Incompatible SELECT list is used in INSERT

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In Sybase and SQL Anywhere, the SQL64 error code indicates that an incompatible SELECT list is used in an INSERT statement, meaning the columns returned do not match the destination table columns.

Multiple choice technology databases
  1. COMMAND NOT SPECIFIED

  2. ALREADY LOGGED IN

  3. SESSION DOES NOT EXIST

  4. None of these

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

SQL1401 indicates that a required command was not specified in the SQL statement being executed. This error occurs when the database system expects a command but none is provided.

Multiple choice technology databases
  1. FAILED TO RETAIN COOPERATIVE TASK

  2. FAILED TO LOAD INFILE

  3. FAILED TO PUT SQL LOCK ON A TABLE

  4. FAILED TO LOCK RECORD FOR WRITING

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

SQL1224 occurs when the database fails to load an input file during operations. The INFILE refers to file handling operations, typically during data import or export processes.

Multiple choice technology databases
  1. DISTINCT NOT ALLOWED

  2. GROUP BY index is not allowed

  3. HAVING is not an aggregate expression

  4. Column function is not allowed

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

SQL1117 indicates that a column function (aggregate function like SUM, COUNT, AVG) was used in a context where SQL syntax rules don't permit it. Column functions require proper grouping or placement in SELECT statements.

Multiple choice technology databases
  1. FOREIGN KEY DOES NOT EXIST

  2. FAILED TO CREATE FOREIGN KEY

  3. FOUND VIEW COLUMN

  4. INDEX ALREADY EXISTS

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

SQL1145 occurs when a statement references a foreign key that doesn't exist in the database schema. This typically happens during ALTER or DROP operations when the specified foreign key constraint is not found.

Multiple choice technology databases
  1. UNEXPECTED HEADER VALUE

  2. INVALID AGENT SIGNATURE

  3. Both 1 and 2

  4. None of these

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In this custom network protocol mapping, the SQL3018 error code represents an unexpected header value, indicating that the received packet header did not match the expected format.

Multiple choice technology databases
  1. UNKNOWN COMMAND

  2. ALREADY LOGGED IN

  3. NOT LOGGED IN

  4. HEADER NOT FOUND

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

SQL3000 is an error code indicating that a required header was not found in the communication protocol or data stream between the client and database server. This typically occurs during connection establishment when expected protocol headers are missing.

Multiple choice technology databases
  1. INVALID AGENT SIGNATURE

  2. STILL LOGGED IN

  3. INVALID STATEMENT ID

  4. HEADER NOT FOUND

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

SQL3017 represents an authentication or authorization error where the agent signature provided during connection is invalid or cannot be verified. The database system rejects connections that don't present proper credentials.

Multiple choice technology databases
  1. Failed to aggregate

  2. Failed to execute DISTINCT

  3. Failed to execute HAVING clause

  4. Failed to execute WHERE clause

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

SQL1816 indicates a failure during aggregation operations in SQL queries. This occurs when the database engine cannot successfully compute aggregate functions like SUM, COUNT, AVG, MAX, or MIN, often due to data type mismatches or grouping issues.

Multiple choice technology databases
  1. Failed to validate CASE expression

  2. Failed to execute UPDATE command

  3. Failed to calculate LIKE predicate pattern

  4. Failed to validate column list

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

SQL1724 indicates a validation failure for the column list specified in a SQL statement. This error occurs when the database cannot verify the existence, accessibility, or compatibility of columns referenced in a query.

Multiple choice technology databases
  1. FAILED TO PARSE YEAR

  2. UNEXPECTED CHARACTER

  3. Failed to parse duration

  4. Failed to parse timestamp

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

SQL1513 occurs when the database engine cannot interpret a duration specification in a query. This typically happens with interval expressions where the duration format is invalid or contains unrecognized tokens.

Multiple choice technology databases
  1. VARIABLE WAS NOT FOUND

  2. POINTER OF UNKNOWN TYPE

  3. RESULT IS NOT A SELECTION

  4. ARRAY NOT ALLOWED IN EXECUTE IMMEDIATE

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

SQL1432 indicates a pointer type error where the database system encounters a pointer of an unrecognized or unsupported type. This is a low-level error related to memory addressing or data type handling in database operations.