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
B
Correct answer
Explanation
JasperReports supports dynamic column hiding through printWhenExpression properties and conditional visibility settings. You can control column visibility based on data conditions, parameters, or expressions within the report template.
B
Correct answer
Explanation
Teradata does not maintain rows in the received order. Teradata distributes rows across AMPs (Access Module Processors) based on hash values of primary index columns, so the physical storage order is not the same as insertion order.
-
Tables with already existing data
-
Empty tables
-
Both 1 & 2
-
None of the above
B
Correct answer
Explanation
Teradata FastLoad (FLOAD) is designed for high-performance loading of large volumes of data into empty tables only. It cannot load data into tables that already contain rows or have active indexes. Distractors suggesting it supports populated tables are incorrect.
-
FROM clause
-
WHERE clause
-
Correlated sub query
-
None of the above
C
Correct answer
Explanation
The TOP option can appear in correlated subqueries. It allows limiting results from the subquery, which is then used by the outer query for comparison or filtering. TOP does not belong in FROM or WHERE clauses directly.
-
The query returns the rows in the query result set without producing an error.
-
Return no rows
-
Produces an error
-
The query returns rows
A
Correct answer
Explanation
When TOP specifies a number greater than available rows, the query returns all rows without error. Database systems handle this gracefully by returning whatever rows exist in the result set, up to the TOP limit.
B
Correct answer
Explanation
To solve this question, the user needs to know how the SQL SELECT statement and concatenation operator (||) work. The SELECT statement retrieves data from a database table and returns a result set. The concatenation operator is used to combine two or more strings into a single string.
The given SQL query concatenates three columns (address1, address2, and address2) using the concatenation operator and then renames the concatenated column as "Address".
The resulting query output will contain only one column named 'Address' that is the result of concatenating the three columns. Therefore, the correct answer is:
The Answer is: B. 1
-
Null
-
Not Null
-
Function NVL2 is not defined
-
None of The above
A
Correct answer
Explanation
NVL2(expr1, expr2, expr3) returns expr2 if expr1 is NOT NULL, else returns expr3. Here expr1 is NULL, so it returns expr3 which is NULL. Output is NULL.
-
DROP
-
DELETE
-
TRUNCATE
-
CASCADE
C
Correct answer
Explanation
TRUNCATE removes all rows from a table without generating rollback data. It's a DDL operation that's faster than DELETE (which is DML and writes to rollback). DROP removes the entire table structure.
C
Correct answer
Explanation
In SQL*Plus, the hyphen (-) is used as a continuation character when a SQL statement spans multiple lines. It indicates the statement continues on the next line.
-
17-JUL-00
-
11-JUL-00
-
09-JUL-00
-
03-JUL-00
A
Correct answer
Explanation
NEXT_DAY(date, day) returns the date of the first specified day-of-week after the given date. Starting from Monday July 10, 2000, the NEXT MONDAY is July 17, 2000 (7 days later). The format mask DD-MON-RR produces '17-JUL-00'.
C
Correct answer
Explanation
NULLIF returns NULL when both arguments are equal. Since both strings are 'testing', they match, so the function returns NULL. The function is designed to prevent errors by converting matching values to NULL.
D
Correct answer
Explanation
In Oracle SQL, the NULLIF(expr1, expr2) function compares two expressions. If they are equal, it returns null; otherwise, it returns expr1. Oracle raises a syntax or validation error if the first argument is a literal NULL.
B
Correct answer
Explanation
NVL2 returns the second argument when the first is NOT NULL, and the third argument when the first IS NULL. Since the first argument is null, NVL2 returns 'third' (the else clause).