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
-
DELETE
-
TRUNCATE
-
REMOVE
-
None of the Above
B
Correct answer
Explanation
TRUNCATE removes all rows and resets the table. DELETE removes rows but preserves tablespace. REMOVE is not a standard SQL command.
-
SELECT Persons.FirstName ;
-
EXTRACT FirstName FROM Persons ;
-
SELECT FirstName FROM Persons;
-
EXTRACT Persons.FirstName
C
Correct answer
Explanation
SELECT column FROM table is the correct syntax. EXTRACT is used for date/time parts, not general column selection.
-
SELECT DIFFERENT
-
SELECT DISTINCT
-
SELECT UNIQUE
-
All of the above
B
Correct answer
Explanation
SELECT DISTINCT eliminates duplicate values. DIFFERENT is not a SQL keyword, and UNIQUE (though valid in some databases) is not standard SQL.
-
Structured Query Language
-
Strong Question Language
-
Structured Question Language
-
None of the Above
A
Correct answer
Explanation
SQL stands for Structured Query Language, the standard language for relational database management systems.
-
Can be the object of an IN or NOT IN clause
-
Can be the object of EXISTS or NOT EXISTS
-
Support quantifiers ALL, ANY, SOME
-
Support LIKE or NOT LIKE used with a
-
Cannot specify more than one column to match
E
Correct answer
Explanation
The statement "Cannot specify more than one column to match" does not hold true generally, as subqueries can return multiple columns when used with operators like EXISTS or in column comparison lists (e.g., (A, B) IN (SELECT X, Y...)). Other options describe correct standard behaviors of subqueries.
-
CREATE
-
DROP
-
MODIFY
-
ALTER
-
GRANT
-
REPLACE
E
Correct answer
Explanation
DDL (Data Definition Language) statements define database structures - these include CREATE, ALTER, DROP, TRUNCATE, and RENAME. GRANT is a DCL (Data Control Language) statement used to give user permissions on database objects, not to define database structures. Since the question asks which is NOT a DDL statement, GRANT is the correct answer.
-
This option is not possible
-
To give comments
-
Override the default sorting
-
None of the above
C
Correct answer
Explanation
In lookup override queries, the double dash (--) is used to override the default sorting behavior of the lookup operation. It allows custom sort orders to be specified.
B
Correct answer
Explanation
Informatica allows nesting of aggregate functions (like SUM(MAX(salary))) but does NOT allow one aggregate function directly inside another aggregate function - you must use group by ports appropriately. The restriction is on direct nesting, not on using multiple aggregate functions in the same expression.
B
Correct answer
Explanation
SQL allows nesting of aggregate functions within aggregate functions, though database engines vary in support. For example, SUM(AVG(column)) is syntactically valid even if not always practical. The statement that only ONE can be nested is incorrect.
-
The Order table must be included in each query.
-
The Order Detail table has conflicting cardinalities.
-
Outer joins are generated when querying from Customer.
-
There is more than one possible path between the tables.
D
Correct answer
Explanation
A transitive relationship or loop in database modeling creates multiple path options when joining tables (e.g., Joining A to C directly vs A to B to C). This ambiguity causes query generation issues because reporting engines have more than one possible join path to retrieve the data.
-
SELECT DISTINCT position, manager
-
SELECT position, manager DISTINCT
-
SELECT position, manager
-
SELECT position, DISTINCT manager
A
Correct answer
Explanation
The DISTINCT keyword must immediately follow the SELECT keyword to filter duplicate rows. Placing DISTINCT elsewhere in the query is syntactically invalid, which rules out all other distractors.
-
SQL*Plus commands cannot be abbreviated.
-
SQL*Plus commands are accesses from a browser.
-
SQL*Plus commands are used to manipulate data in tables.
-
SQL*Plus commands manipulate table definitions in the database.
C,D
Correct answer
Explanation
SQL*Plus is Oracle's command-line interface for executing SQL commands. It can manipulate actual table data (C) and database schema definitions (D) using SQL statements. SQL*Plus commands CAN be abbreviated, contradicting A.
-
Insert
-
update
-
select
-
describe
-
delete
-
rename
D
Correct answer
Explanation
DESCRIBE is a SQL*Plus-specific command that displays table/column metadata. Options A, B, E, and F are SQL commands; 'describe' is the only SQL*Plus command listed.
-
Selection, projection, join
-
Difference, projection, join
-
Selection, intersection, join
-
Intersection, projection, join
-
Difference, projection, product
A
Correct answer
Explanation
This query performs selection (WHERE clause filters rows), projection (SELECT chooses specific columns), and join (connects EMP and DEPARTMENT tables). These are fundamental SQL capabilities.
-
The sort is in ascending by order by default
-
The sort is in descending order by default
-
The ORDER BY clause must precede the WHERE clause.
-
The ORDER BY clause is executed on the client side.
-
The ORDER BY clause comes last in the SELECT statement.
-
The ORDER BY clause is executed first in the query execution.
A,E
Correct answer
Explanation
The ORDER BY clause sorts results in ascending order (ASC) by default. It is positioned last in the SELECT statement structure, after WHERE, GROUP BY, and HAVING clauses. Options B, C, D, and F are incorrect - ORDER BY does not default to descending, must come after WHERE, executes on the server, and is not executed first.