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
-
GENERATE SEQUENCE SE START WITH 30 ADD BY 20;
-
CREATE SEQUENCE SE START WITH 30 ADD BY 20;
-
CREATE SEQUENCE SE START WITH 30 INCREMENT BY 20;
-
GENERATE SEQUENCE SE INITIATE WITH 30 INCREMENT BY 20;
C
Correct answer
Explanation
The correct syntax is 'CREATE SEQUENCE SE START WITH 30 INCREMENT BY 20'. Options A and D incorrectly use 'GENERATE' instead of 'CREATE'. Option B uses 'ADD BY' which is not valid - the keyword is INCREMENT BY. Option C has the correct CREATE keyword, START WITH for initial value, and INCREMENT BY for the step value.
-
Table name can be an oracle reserved word
-
Table names must begin with a letter
-
Table names can contain in it numbers also
-
None of the Above
A
Correct answer
Explanation
When creating a table using CREATE TABLE in Oracle SQL, the table name cannot be a database reserved word (e.g., SELECT, TABLE). Table names must start with a letter and can contain numbers, making the reserved word restriction the only disallowed option listed.
-
Views are windows of existing table
-
Creation of view is done by using CREATE VIEW statement
-
Views do not contain data but table from which it is created contain data
-
All the Above
D
Correct answer
Explanation
All statements about Views are true. Views are virtual tables (windows) that don't store data themselves but display data from underlying tables. They are created using the CREATE VIEW statement. Views provide abstraction, security, and simplify complex queries. Option D ('All the Above') is correct because A, B, and C are all accurate statements about Views.
-
Non- procedural language
-
Procedural language
-
Database Language
-
Both A. and C.
D
Correct answer
Explanation
SQL is both non-procedural and a database language. Non-procedural means you specify WHAT data you want (declarative), not HOW to retrieve it (procedural). SQL is a domain-specific database language for relational databases. Option D is correct because it combines both characteristics - SQL's non-procedural nature and its role as a database language.
-
Sub queries must be enclosed in parenthesis
-
BETWEEN cannot be used with a sub query
-
Both A. and B.
-
None of the Above
C
Correct answer
Explanation
In SQL, subqueries must be enclosed in parentheses to define their scope within the main query. In addition, the BETWEEN operator cannot directly compare a value against a multi-row subquery without using operators like ANY or ALL. Therefore, both statements are true.
-
CHAR
-
VARCHAR
-
VARCHAR2
-
All the Above
D
Correct answer
Explanation
CHAR, VARCHAR, and VARCHAR2 are all character data types in SQL. CHAR is fixed-length, VARCHAR is variable-length (standard SQL), and VARCHAR2 is Oracle's proprietary variable-length type with additional features. All three store character/string data, making 'All the Above' the correct answer. These types are used for text data like names, addresses, and descriptions.
-
Domain
-
field of a table
-
check table
-
Type
D
Correct answer
Explanation
In SAP, search help attachments are configured for domains, table fields, and check tables. 'Type' by itself is not a valid attachment point in the data dictionary - it's a property of domains, not a standalone object for search help.
-
data is filtered in the database
-
data is filtered on the network
-
data is filtered in the sapgui
-
data is filtered at the application server
A
Correct answer
Explanation
Subqueries execute filtering logic within the database engine itself, returning only pre-filtered results. This avoids transferring large datasets across the network to the application server or SAPGUI for filtering, significantly improving performance.
-
Set
-
Multiset
-
Volatile
-
Temporary
B
Correct answer
Explanation
A Multiset table in Teradata allows duplicate rows to be inserted, unlike a Set table which enforces uniqueness. Volatile and Temporary tables are table types related to scope/lifetime, not duplicate handling. The Multiset option is specifically designed to permit duplicate records.
A
Correct answer
Explanation
Teradata does have a ROWID pseudo-column that uniquely identifies each row in a table. This is accessible through the ROWID keyword in queries, similar to how other databases have row identifiers.
A
Correct answer
Explanation
UPI (Unique Primary Index) enforces uniqueness on the index column(s) in Teradata, ensuring no two rows have the same index value. NUPI allows duplicates, while NUSI and USI are secondary indexes.
D
Correct answer
Explanation
Teradata supports a maximum of 2048 columns in a single table. This is a hard limit in the Teradata database architecture. Options like 256, 512, or 1024 columns are too low and don't represent Teradata's actual column capacity.
-
length
-
char_length
-
char_len
-
len
D
Correct answer
Explanation
Different database systems use different function names for string length operations. Sybase uses char_length(), while Microsoft SQL Server and Adaptive Server Enterprise use len() to return the number of characters in a string expression. This is a common migration consideration when converting between database platforms.
-
is not null
-
is null
-
!= null
-
<> null
A
Correct answer
Explanation
SQL standards specify that NULL comparisons must use IS NULL or IS NOT NULL syntax rather than equality operators. The Sybase operator "<> null" (not equal to null) must be converted to the standard SQL "is not null". Using "!= null" or keeping "<> null" will not work correctly in standard SQL because NULL requires special handling.