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. These are Operators .Which are used to filter records based on more than one conditions.

  2. These Operators are used to join two tables.

  3. Never used in SQL

  4. None

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

In SQL, AND and OR are logical operators used in the WHERE clause to filter records by combining multiple conditions. They do not join tables (which is done via JOIN operations) and are widely used in database querying, making the first option correct.

Multiple choice technology databases
  1. BETWEEN -->>Used for range with in values

  2. LIKE -->>Used for Search a pattern

  3. IN -->>return east one of the columns in given set of values

  4. None

Reveal answer Fill a bubble to check yourself
A,B,C Correct answer
Explanation

BETWEEN filters rows within a range (inclusive). LIKE searches for patterns using wildcards (% and _). IN checks if a value equals at least one value in a set (not 'east' - likely a typo for 'at least' or 'exists'). D is false.

Multiple choice technology databases
  1. true.

  2. false.

  3. both are not used into SQL.

  4. Both are used assembly languages only.

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

In SQL, both <> and != are standard inequality operators - they are functionally identical. Both are valid in SQL (not assembly only), and both serve the same 'not equal' purpose.

Multiple choice technology
  1. Get_group_row_count System Variables

  2. Get_group_col_count System Variables

  3. Get_row_count System Variables

  4. Get_col_count System Variables

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

The built-in system variable Get_group_row_count in Oracle Reports specifically returns the number of rows in a group. This is used for conditional logic, calculations, and formatting that depends on group size.

Multiple choice technology mainframe
  1. Syntactically valid combination of words and clauses

  2. Sequence of one or more statements terminated by period

  3. Words and characters specifying attribute of entry

  4. Syntactically valid combination of words

  5. Sequence of one or more statements terminated by comma

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

In COBOL, a Clause is the lowest-level syntactic unit that specifies attributes or characteristics of an entry. Clauses consist of words and characters that define properties like data types, picture clauses, or usage clauses. They are not complete statements (terminated by periods) but rather descriptive elements within entries.

Multiple choice technology mainframe
  1. RENAME

  2. REDEFINE

  3. CONDITION NAMES

  4. NONE

  5. ALL

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

In COBOL, the LEVEL-66 clause is the RENAME clause. It allows you to regroup existing data items under an alternative name for easier reference. RENAME (level 66) is different from REDEFINES (level 01-49) and CONDITION NAMES (level 88).

Multiple choice technology mainframe
  1. True

  2. False

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

SEARCH ALL requires the table to be arranged in a specific order (ASCENDING or DESCENDING) as defined by the KEY clause. For predictable results, the key must uniquely identify each table entry. If duplicates exist, SEARCH ALL may return any matching entry, making the result unpredictable. This requirement is due to the binary search algorithm used.

Multiple choice technology mainframe
  1. True

  2. False

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

SEARCH ALL uses a binary search algorithm, which requires the table to be sorted in a known order (ASCENDING or DESCENDING). Additionally, for binary search to work correctly and predictably, each key value must be unique so the search can definitively locate a single occurrence. Option A correctly states both requirements.

Multiple choice technology programming languages
  1. It must be used with the REQUIRED integrity constraint.

  2. It ignores the specified integrity constraints if any of the rows that you want to insert or update do not meet the constraint criteria.

  3. It restores your table to its original state if any of the rows that you try to insert or update do not meet the specified integrity constraint criteria.

  4. It allows rows that meet the specified integrity constraint criteria to be inserted or updated, but rejects rows that do not meet the integrity constraint criteria.

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

The UNDO_POLICY=REQUIRED option in SAS SQL ensures that if any rows in an INSERT or UPDATE operation fail to meet the specified integrity constraint criteria, the entire operation is rolled back and the table is restored to its original state before the operation began. This provides transactional integrity by preventing partial updates. Option C correctly describes this behavior.

Multiple choice technology programming languages
  1. Table One and Table Two X Y X Z ------------ 1 2 2 5 1 2 3 6 1 2 4 9 2 3 2 5 2 3 3 6 2 3 4 9

  2. Table One and Table Two X Y X Z ------------ 1 2 2 5 2 3 2 5

  3. Table One and Table Two X Y Z ------------ 1 2 5 2 3 5

  4. Table One and Table Two X Y Z ------------ 1 2 . 2 3 5

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

The query performs a Cartesian product (cross join) of tables ONE and TWO because no WHERE clause joins them. Table ONE has 2 rows (X=1,Y=2 and X=2,Y=3) and Table TWO has 3 rows (X=2,Z=5, X=3,Z=6, X=4,Z=9). The result is 2 × 3 = 6 rows, combining each row from ONE with each row from TWO. Option A shows all 6 rows correctly.

Multiple choice technology web technology
  1. True

  2. False

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

Both CODE 1 and CODE 2 perform an inner join between tables sql.oilprod and sql.oilrsrvs on the country column. CODE 1 uses the older comma-separated tables syntax with WHERE clause for joining, while CODE 2 uses the explicit INNER JOIN syntax with ON clause. Both produce identical results - they are equivalent SQL statements.

Multiple choice technology programming languages
  1. One and Two Joined One b Two b ------------------- a 1 a 1 b 2 b 2 d 4 d 4 c . e . c . f .

  2. One and Two Joined One b Two b ------------------- a 1 a 1 b 2 b 2 c . c . d 4 d 4 c . e . c . f .

  3. One and Two Joined One b Two b ------------------- a 1 a 1 b 2 b 2 c . c . d 4 d 4

  4. One and Two Joined One b Two b ------------------- a 1 a 1 b 2 b 2 . . . . d 4 d 4

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

The query performs an inner join on column b between tables ONE and TWO. Matching rows: both have (a,1), (b,2), (c,.) with NULL/SAS missing values. The row (d,4) appears in both tables. Row (e,.) and (f,.) in table TWO don't have matches in ONE. The inner join returns all matched rows including NULL matches on the join column. Option B correctly shows all 6 matched rows.

Multiple choice technology programming languages
  1. Table JOINED Flight Supervisor Flight Destination ------------------------------------------- 145 Kang 145 Brussels 145 Kang 145 Edmonton 145 Ramirez 145 Brussels 145 Ramirez 145 Edmonton 150 Miller 150 Paris 150 Miller 150 Madrid 150 Picard 150 Paris 150

  2. Table JOINED Flight Supervisor Flight Destination ------------------------------------------- 145 Ramirez 145 Edmonton 150 Picard 150 Madrid

  3. Table JOINED Flight Supervisor Flight Destination ------------------------------------------- 145 Kang 145 Brussels 145 Kang 145 Edmonton 150 Miller 150 Paris 150 Miller 150 Madrid

  4. Table JOINED Flight Supervisor Flight Destination ------------------------------------------- 145 Kang 145 Brussels 145 Ramirez 145 Brussels 150 Miller 150 Paris 150 Picard 150 Paris 150 Picard 150 Madrid

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

The SQL query performs an inner join between fltsuper and fltdest on Flight. Flight 145 appears twice in both tables (2×2=4 combinations), Flight 150 appears twice in both tables (2×2=4 combinations). The other flights (155, 157 in fltsuper; 165 in fltdest) have no matches and are excluded from the inner join result. The output has 8 rows total. Option A correctly shows the pattern, though it appears truncated at the end.