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
In Oracle SQL, substr('SQL Functions', -10, 12) extracts a substring starting 10 characters from the end (' Functions') with a length of 12. Since only 10 characters remain, it returns ' Functions'. The length of this string is 10, making 10 the correct output.
B
Correct answer
Explanation
The REPLACE function in SQL is a string manipulation function that modifies the string value in the query's output projection. It does not update or alter the actual data stored in the database tables, making the statement false.
B
Correct answer
Explanation
In Ab Initio's Join component, the count parameter specifies how many input flows to join. The default value is 2, as a join operation fundamentally requires at least two inputs to combine data from different sources.
-
-
-
+
-
0
-
1
-
None of the above
D
Correct answer
Explanation
The abs function returns absolute value, so abs(-88) = 88. The sign function returns 1 for positive numbers, -1 for negative, and 0 for zero. Therefore sign(abs(-88)) = sign(88) = 1.
A
Correct answer
Explanation
In Siebel CRM, tables are extensible because developers can add custom columns to existing tables using 1:1 extension tables or custom extension tables. Business Components (BC), Fields, and Applets are configured or modified, but the physical database schema extension applies to Tables.
-
*#\$*#\$sql function
-
error
-
*#$*#sql functions
-
None of the above
C
Correct answer
Explanation
lpad pads the string 'sql functions' (13 chars) on the left to reach 18 characters using pattern '#$'. The pattern repeats: '#$#$' (6 chars) + 'sql functions' (12 chars) would be 18, but we need exactly 18. The pattern '#$#' (5 chars) + 'sql functions' (13 chars) = 18 characters. Option C shows '#$*#sql functions' which is the correct padding.
-
Joins are between two tables
-
Joins cannot be updated
-
Joins are used in multi value groups
-
Joins are created in the client
A
Correct answer
Explanation
SQL joins fundamentally operate between two tables (or table-like objects) by matching related columns. While some databases support joining more than two tables in a single query, the basic join operation always involves exactly two tables at its core. Joins are server-side operations and can be part of updatable views.
-
Custom Table
-
Intersect Table
-
Interface Table
-
Data Table
A
Correct answer
Explanation
In database table classification, a Custom Table is a private table created and owned by a specific user or application, not shared across the system. Intersect tables handle many-to-many relationships, Interface tables facilitate data exchange, and Data tables are general-purpose shared tables.
D
Correct answer
Explanation
The INSTR function searches for a substring within a string. With start_position=-1, it searches backwards from the end of the string. The occurrence parameter specifies which occurrence to find. Since 'd' exists in 'oracle' at position 15, the function should return 15. However, if the function returns 0, it could indicate either the substring was not found or there's a specific behavior with negative start positions that depends on Oracle version. The correct answer depends on actual Oracle behavior.
-
Adding positions is only allowed by a primary team member.
-
Adding positions is only allowed when the project is locked
-
Adding positions is only allowed when connected to server
-
Adding positions is only allowed when the local database is locked
C
Correct answer
Explanation
In database systems that support local caching, adding positions typically requires an active server connection to ensure data consistency and synchronization. When disconnected, the local database is often read-only to prevent conflicts. Options A, B, and D are incorrect because team member roles, project locks, and database locks do not control this fundamental connectivity requirement.
-
18
-
19
-
21
-
none of the above
A
Correct answer
Explanation
The SQL query uses LENGTH() function on the string 'This is Ram''s book'. The double quote ('') in SQL represents a single literal quote character. Counting: T-h-i-s- -i-s- -R-a-m-'-s- -b-o-o-k = 18 characters. The LENGTH function counts all characters including spaces and the apostrophe.
-
1x4y6789
-
1xy456789
-
1xy46789
-
error
C
Correct answer
Explanation
The Oracle TRANSLATE function replaces characters in a string. It maps '2' to 'x' and '3' to 'y'. Because '5' has no corresponding character in the replacement string 'xy', it is removed entirely. Thus, '123456789' becomes '1xy46789'.
-
1x4y6789
-
1xy456789
-
1xy46789
-
error
C
Correct answer
Explanation
TRANSLATE('source', 'from', 'to') replaces each character in 'from' with corresponding character in 'to'. Here: '235' maps to 'xy' (2→x, 3→nothing, 5→y). So '123456789' becomes '1xy46789' - 2 becomes x, 3 is removed, 5 becomes y. The key is understanding that 3 maps to empty string.