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
-
DESCRIBE
-
RENAME
-
DELETE
-
INSERT
A
Correct answer
Explanation
DESCRIBE is an iSQL*Plus command that displays the structure of a table or other database object. RENAME, DELETE, and INSERT are SQL statements (DDL/DML), not iSQL*Plus-specific commands. DESCRIBE can be abbreviated as DESC and provides column names, data types, and constraints.
B
Correct answer
Explanation
MERGE is a DML (Data Manipulation Language) statement that combines insert and update operations based on a condition. DROP and CREATE are DDL (Data Definition Language), and COMMIT is a transaction control statement. DML includes SELECT, INSERT, UPDATE, DELETE, and MERGE.
-
National Language Set
-
International Language Set
-
Oracle Language Set
-
SQL-99 compliant Language Set
A
Correct answer
Explanation
National Language Support (NLS) parameters in Oracle are used to customize the display of date, time, currency, and language settings. International, Oracle, and SQL-99 compliant Language Sets are not standard terms for configuring these display formats.
-
multiply_months(x,y)
-
add_months(x,y)
-
devide_months(x,y)
-
upper(x)
B
Correct answer
Explanation
In Oracle SQL and PL/SQL, add_months is a built-in date function used to add a specified number of months to a date. Functions like multiply_months or devide_months do not exist.
-
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.
-
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.