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
-
multiply_months(x,y)
-
add_months(x,y)
-
devide_months(x,y)
-
upper(x)
-
compose
-
decompose
-
translate
-
retranslate
D
Correct answer
Explanation
Oracle SQL includes TRANSLATE for character replacement, and COMPOSE/DECOMPOSE for Unicode handling. RETRANSLATE does not exist as a built-in Oracle function.
-
multiply_months(x,y)
-
add_months(x,y)
-
devide_months(x,y)
-
upper(x)
B
Correct answer
Explanation
Oracle SQL provides the add_months(x, y) function to add a specified number of months to a date. The other options, multiply_months and devide_months, do not exist in Oracle SQL, while upper(x) is a character function used to convert text to uppercase.
-
Using lookup() function
-
Using Generate Records component
-
Using re_index() function
-
Using next_in_sequence() function
D
Correct answer
Explanation
next_in_sequence() is the Ab Initio function designed specifically for generating surrogate keys by producing sequential, unique integer values. The lookup() function retrieves data, Generate Records is a component, and re_index() is for reindexing.
-
Inner Join
-
Explicit Join ( record-required 0 = true, record-required 1 = true )
-
Explicit Join ( record-required 0 = false, record-required 1 = true )
-
Explicit Join ( record-required 0 = true, record-required 1 = false )
C
Correct answer
Explanation
The question requires a join that outputs matching records PLUS all unmatching records from In0. This is a left outer join where In0 is the left/preserved side. In AbInitio Explicit Join, record-required 0=false means In0 records are preserved even without matches, and record-required 1=true means In1 records require matches. Option C correctly shows this configuration: (record-required 0=false, record-required 1=true). Option A is inner join (both required). Option B requires matches from both sides. Option D would preserve In1, not In0.
-
EVALUATE … END-EVALUATE
-
SWITCH CASE
-
CASE … END-CASE
-
None of the above
C
Correct answer
Explanation
The question asks about conditional execution based on a field value in Easytrieve. Option C 'CASE...END-CASE' is claimed correct and is indeed the Easytrieve construct for multi-way branching similar to switch/case in other languages. Option A 'EVALUATE' is not valid Easytrieve syntax. Option B 'SWITCH CASE' is not correct syntax. Option D is incorrect since CASE...END-CASE exists.
-
A. Call the ADO.Close function
-
B. Use the close method for the RecordSet object
-
C. Set the RecordSet and Connection objects equal to Nothing
-
D. Use the close method for the RecordSet and Connection objects
D
Correct answer
Explanation
To properly clean up database resources in VBScript/ADO, you must explicitly call the .Close method on both the RecordSet and Connection objects to terminate the active session.
-
SELECT *
-
FROM emp
-
WHERE comm = NULL
-
There is no error in this statement.
C,D
Correct answer
Explanation
In SQL table naming conventions, the special characters allowed (depending on database) include @ and $ in many systems like SQL Server and MySQL. The ampersand (&) and hash (#) characters are typically not allowed or have special meanings (e.g., # for temporary tables in some databases). Specific rules vary by database system, but @ and $ are commonly permitted for naming purposes.
-
Structure Query Language
-
Structured Query Language
-
Structure Queried Language
-
None of the above
B
Correct answer
Explanation
SQL stands for Structured Query Language. It's a standard programming language designed for managing and manipulating relational databases. SQL is used for querying, updating, and managing data in database management systems.
C,D
Correct answer
Explanation
Statement III is correct because DCL includes GRANT and REVOKE. Statement IV is correct because DDL includes CREATE, DROP, and ALTER. Statements I and II are incorrect because they mix up DDL and DML commands.
-
Table can have 100 column at MAX
-
Table can have 1000 column at MAX
-
Table can have 10,000 column at MAX
-
Table can have unlimited column
B
Correct answer
Explanation
SQL Server tables support up to 1024 columns, making 1000 the closest correct answer among the options provided.
A
Correct answer
Explanation
SQL allows column aliases defined in the SELECT clause to be referenced in the ORDER BY clause, making queries more readable and maintainable.
-
TRUNCATE
-
DELETE
-
DROP
-
REMOVE
C
Correct answer
Explanation
DROP is the correct command to completely remove a table with all its constraints; TRUNCATE fails with foreign key constraints, DELETE only removes rows, and REMOVE is not a valid SQL command.
-
Outer Join view (complex view) is not updateable
-
USER_View contain Status of view
-
USER_ViEw NOT contain Status of view
-
DML opration may NOT applied on view having Group by clasue