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
A
Correct answer
Explanation
IGNORE DUPLICATE ROWS is ignored when a table has unique indexes because the unique index constraint still enforces uniqueness at the database level. The option only applies to tables without unique indexes.
A
Correct answer
Explanation
Teradata MLOAD supports the DROP DDL statement, allowing users to drop tables as part of the MLOAD script. However, MLOAD does not support CREATE, ALTER, or RENAME DDL statements - these must be executed separately outside of MLOAD. MLOAD is optimized for high-volume data loading with limited DDL support, focusing on DELETE and INSERT operations along with DROP for target table management.
B
Correct answer
Explanation
In SQL join conditions, table names are NOT mandatory when column names are unambiguous (unique across joined tables). However, it's best practice to qualify column names to avoid ambiguity and improve code clarity.
-
Return records which have no direct match
-
Return records which have direct match
-
Return all the records
-
None of the above
A
Correct answer
Explanation
An outer join returns records from one table even when there's no matching record in the other table. This is useful for finding unmatched records (like customers without orders) or maintaining all records from a primary table.
A
Correct answer
Explanation
The (+) symbol is the Oracle-specific outer join operator, traditionally used before ANSI standard JOIN syntax was adopted. It's placed on the side of the join condition that may be missing (NULL).
-
Selfjoin
-
Outerjoin
-
innerjoin
-
equijoin
A
Correct answer
Explanation
A self-join joins a table to itself, treating it as if it were two separate tables. This is useful for comparing rows within the same table, such as finding employee-manager relationships in an employees table.
-
9
-
11
-
5
-
12
-
None of the above
A
Correct answer
Explanation
To join N tables together, you need N-1 join conditions. For 10 tables, you need 9 join statements. This follows the principle that each new table requires one additional join to link it to the existing structure.
B
Correct answer
Explanation
SQL allows ordering by column aliases defined in the SELECT list, because the alias is resolved after the SELECT clause but before ORDER BY is processed. Hence sorting by an alias is possible, making the claim that it isn’t possible false.
-
Single-row Functions and Double-row Functions
-
One-row Functions and Two-row Functions
-
Single-row Functions and Multiple-row Functions
-
None of the above
C
Correct answer
Explanation
SQL functions are categorized into single-row functions (operate on one row at a time, like UPPER, SUBSTR) and multiple-row functions (operate on groups of rows, like SUM, COUNT, AVG). This classification determines how they're used in queries.
B
Correct answer
Explanation
Single‑row functions, such as UPPER or SYSDATE, operate on each row individually and return exactly one value per row. They cannot produce multiple results from a single input row; that behavior belongs to set‑returning functions, making the statement false.
A
Correct answer
Explanation
The LIKE operator is standard SQL terminology for performing wildcard searches using pattern matching characters. It is used in the WHERE clause.
-
Table1.column1=Table2.column2
-
Table1.column1=Table2.column1
-
Table1.column2=Table2.column1
-
None of the above
B
Correct answer
Explanation
An equi-join is a join based on equality between columns, typically joining on the same column name from different tables. Option B shows Table1.column1 = Table2.column1, which represents an equi-join condition where the same column from both tables is being compared for equality.
A
Correct answer
Explanation
A non-equijoin is a join condition that evaluates relationships other than equality, such as using operators like BETWEEN, greater than, or less than. It matches values within specified ranges rather than exact matches.