Computer Knowledge

Database and SQL

3,929 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. 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.

Multiple choice technology databases
  1. FUNCTIONALITY IS NOT IMPLEMENTED

  2. NO MORE JOIN SEEDS POSSIBLE

  3. Both 1 and 2

  4. None of these

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

SQL1203 indicates that a requested feature or function is not implemented in the current database system. This is a capability error where the SQL engine doesn't support the specific operation being attempted.

Multiple choice technology databases
  1. Access denied

  2. EXECUTION INTERRUPTED BY USER

  3. REMOTE SQL SERVER IS NOT AVAILABLE

  4. SQL SERVER IS NOT RUNNING

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

In this specific database client mapping, the SQL1004 error code indicates that access was denied, typically due to invalid credentials or insufficient permissions to connect to the database.

Multiple choice technology databases
  1. Superkey

  2. Candidate key

  3. Primary key

  4. Composite key

Reveal answer Fill a bubble to check yourself
A,B,C,D Correct answer
Explanation

All four options are SQL key concepts. Superkey (A) uniquely identifies tuples. Candidate key (B) is a minimal superkey. Primary key (C) is a selected candidate key. Composite key (D) is a key made of multiple attributes. All are correct.