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

Multiple choice technology programming languages
  1. GENERATE SEQUENCE SE START WITH 30 ADD BY 20;

  2. CREATE SEQUENCE SE START WITH 30 ADD BY 20;

  3. CREATE SEQUENCE SE START WITH 30 INCREMENT BY 20;

  4. GENERATE SEQUENCE SE INITIATE WITH 30 INCREMENT BY 20;

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. Table name can be an oracle reserved word

  2. Table names must begin with a letter

  3. Table names can contain in it numbers also

  4. None of the Above

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. Views are windows of existing table

  2. Creation of view is done by using CREATE VIEW statement

  3. Views do not contain data but table from which it is created contain data

  4. All the Above

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. Non- procedural language

  2. Procedural language

  3. Database Language

  4. Both A. and C.

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. Sub queries must be enclosed in parenthesis

  2. BETWEEN cannot be used with a sub query

  3. Both A. and B.

  4. None of the Above

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. CHAR

  2. VARCHAR

  3. VARCHAR2

  4. All the Above

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. Domain

  2. field of a table

  3. check table

  4. Type

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. data is filtered in the database

  2. data is filtered on the network

  3. data is filtered in the sapgui

  4. data is filtered at the application server

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology databases
  1. Set

  2. Multiset

  3. Volatile

  4. Temporary

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology databases
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology databases
  1. length

  2. char_length

  3. char_len

  4. len

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology databases
  1. is not null

  2. is null

  3. != null

  4. <> null

Reveal answer Fill a bubble to check yourself
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.