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 databases
  1. percentage sign

  2. Quotation marks

  3. Ampersand

  4. Ellipses

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

To solve this question, the user needs to be aware of the syntax used to specify runtime variables in SQL SELECT statements.

The correct answer is:

C. Ampersand

Explanation: In SQL SELECT statements, runtime variables are specified using the ampersand (&) character followed by the variable name. For example, to specify a variable named "dept_name", you would use "&dept_name" in the SELECT statement. This allows users to enter a value for the variable at runtime, rather than hard-coding the value into the query.

Option A (percentage sign) is incorrect, as this character is commonly used as a wildcard operator in SQL, but not for specifying runtime variables.

Option B (quotation marks) is also incorrect, as quotation marks are used to delimit string literals in SQL, but not for specifying runtime variables.

Option D (ellipses) is incorrect, as ellipses are not used in SQL syntax for specifying runtime variables.

Therefore, the correct answer is:

The Answer is: C. Ampersand

Multiple choice technology databases
  1. No effect

  2. The index will be rendered invalid

  3. The index will be dropped

  4. The index will contain NULL values.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

When a table is dropped, all indexes associated with that table are automatically dropped as well. This is because indexes are dependent objects that cannot exist without the base table.

Multiple choice technology databases
  1. Names starting with “a”

  2. Names with "a" as second character

  3. Last character as "a"

  4. Names with atleast two "a" at the start.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The LIKE pattern '_a%' uses underscore as a single-character wildcard, so it matches names where the second character is 'a'. The percent sign allows any characters after that.

Multiple choice technology mainframe
  1. SELECT DATE(tablename.Date_variable, ISO)

  2. SELECT (tablename.Date_variable AS DATE)

  3. SELECT CHAR(CAST (tablename.Date_variable AS DATE), ISO)

  4. ALL OF THEM

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In DB2, converting a date field to a specific character string format is done using the CHAR() function with the date value and an optional format identifier like ISO. The syntax CHAR(CAST(column AS DATE), ISO) is syntactically valid and returns the formatted date string.

Multiple choice technology mainframe
  1. 0001-01-01 and 0000-00-00-00.00.00.000000

  2. 0001-01-01 and 0001-01-01-01.01.01.000001

  3. 0000-00-00 and 0000-00-00-00.00.00.000000

  4. 0001-01-01 and 0001-01-01-00.00.00.000000

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

For null date/timestamp values in certain legacy systems, low-date returns 0001-01-01 and low-timestamp returns 0001-01-01-00.00.00.000000 as minimum default values.

Multiple choice technology
  1. renaming the rule

  2. changing the priority of rule

  3. moving a rule to a target package

  4. delete the rule

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In Rule Studio, queries can trigger actions like deploying rules, changing priorities, and moving rules between packages. However, renaming a rule typically requires direct editing through the rule editor interface rather than being triggered by a query operation. Query operations are designed for bulk management tasks, while renaming is an individual rule property change.

Multiple choice technology
  1. cannot happen

  2. can only be shown as warning

  3. can be shown as error

  4. causes error at runtime

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

When condition column values overlap between rows in a decision table, it can indicate ambiguous or unreachable rules, but Rule Studio typically flags this as a warning rather than an error. This is because overlaps might be intentional (with rule priority determining which fires first) or simply informational about potential logic issues.

Multiple choice technology
  1. only for BAL rules

  2. only for decision tales

  3. For both BAL rules and decision tables

  4. none

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

BAL (Business Action Language) rules require a Definitions section to declare vocabulary, variables, and terms used in rule logic. Decision tables use a different structure - conditions and actions are defined directly in columns and rows, without a separate Definitions section. The question correctly identifies this distinction.

Multiple choice technology
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In decision tables, empty cells in condition columns are not allowed as they create ambiguity. Each condition cell must have a defined value or expression to properly evaluate the rule logic. An empty condition would make it impossible to determine whether that condition is satisfied, leading to unpredictable behavior.

Multiple choice technology databases
  1. SELECT

  2. WHERE

  3. SEARCH

  4. FIND

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The WHERE clause in SQL specifies conditions that rows must meet to be included in the result set. It filters data after the FROM clause retrieves it but before any grouping or aggregation happens. Without WHERE, all rows from the table are returned.

Multiple choice technology databases
  1. DELETE clause

  2. INSERT clause

  3. SELECT clause

  4. JOIN clause

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The HAVING clause filters aggregated results and can only be used with SELECT statements that include GROUP BY. While WHERE filters individual rows before aggregation, HAVING filters groups after aggregation. HAVING cannot be used with DELETE, INSERT, or alone - it requires a SELECT query context.

Multiple choice technology databases
  1. Strong Query Language

  2. Standard Query Language

  3. Strict Query Language

  4. Structured Query Language

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

SQL stands for Structured Query Language, the standard language for managing and querying relational databases. The name reflects its structured approach to retrieving, manipulating, and defining data. It was developed at IBM in the 1970s and became an ANSI standard in 1986.