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. ALTER TABLE students ADD PRIMARY KEY student_id;

  2. ALTER TABLE students ADD CONSTRAINT PRIMARY KEY (student _ id);

  3. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY (student _ id);

  4. ALTER TABLE students ADD CONSTRAINT stud _ id _pk PRIMARY KEY (student _ id);

  5. ALTER TABLE students MODIFY CONSTRAINT stud _ id _pk PRIMARY KEY (student _ id);

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

To add a primary key with ALTER TABLE, you must use ADD CONSTRAINT with a constraint name and PRIMARY KEY keyword. Option D follows the correct syntax, though note that the column name appears to have unusual spacing. Option A lacks parentheses and constraint name, B lacks the constraint name before PRIMARY KEY, C has potential naming issues, and E uses MODIFY which is not correct for adding constraints.

Multiple choice technology databases
  1. ALTER TABLE table_name ENABLE constraint_name;

  2. ALTER TABLE table_name STATUS = ENABLE CONSTRAINT constraint _ name;

  3. ALTER TABLE table_name ENABLE CONSTRAINT constraint _ name;

  4. ALTER TABLE table_name TURN ON CONSTRAINT constraint _ name;

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

To turn on an existing constraint, option C is correct:

The correct syntax to turn on an existing constraint is:

C. ALTER TABLE table_name ENABLE CONSTRAINT constraint_name;

Option A is also a valid syntax for enabling a constraint.

Option B is incorrect because there is no "STATUS" option for the ALTER TABLE statement.

Option D is incorrect because there is no "TURN ON" option for the ALTER TABLE statement.

Therefore, the answer is: C. ALTER TABLE table_name ENABLE CONSTRAINT constraint_name;

Multiple choice technology databases
  1. True

  2. False

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

Triggers execute within the transaction scope of the triggering statement. DDL operations like CREATE TABLE are prohibited because they would require implicit commits that conflict with the trigger's transactional context and could cause rollback issues.

Multiple choice technology
  1. DROP OR REPLACE ‘trigger_name’;

  2. CREATE OR RENAME TRIGGER ‘trigger_name’;

  3. CREATE OR REPLACE TRIGGER ‘trigger_name’;

  4. CREATE OR RECREATE TRIGGER ‘trigger_name’;

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

The SQL syntax for creating a new trigger or replacing an existing one is CREATE OR REPLACE TRIGGER followed by the trigger name. This allows modifying a trigger without first dropping it.

Multiple choice technology platforms and products
  1. Inner Join

  2. Explicit Join

  3. Full Outer join

  4. None of the above

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

The Join component in Ab Initio supports all standard join types: Inner Join, Full Outer Join, Left Outer Join, and Right Outer Join. 'Explicit Join' is not a standard join category, and since all valid join types ARE available, 'None of the above' is correct.

Multiple choice technology programming languages
  1. True

  2. False

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

The WHERE statement does NOT perform automatic type conversion - if you compare character and numeric values, SAS will produce an error. Unlike some other SAS statements that attempt implicit conversions, WHERE requires compatible types or explicit conversion functions.

Multiple choice technology web technology
  1. GETDATA

  2. GETDB

  3. DGET

  4. None of the Above

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

DGET is a database function that extracts a single record from a database that matches specified criteria. Unlike other database functions that perform calculations or aggregations, DGET retrieves actual field values from one matching record. It returns an error if multiple records match the criteria.

Multiple choice technology web technology
  1. DAVERAGE

  2. AVERAGEDATE

  3. AVGDATE

  4. DGET

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

DAVERAGE is a database function that calculates the average of values in a column of a database list that match specified conditions. The 'D' prefix indicates it's a database function, not the regular AVERAGE function. Options like AVERAGEDATE and AVGDATE don't exist in Excel.

Multiple choice technology mainframe
  1. YES

  2. NO, any condition along with equal can be checked

  3. Except Equal condition any condition can be chencked

  4. It Depends on the use of Search statement on perticular scenario

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

In COBOL, the SEARCH ALL statement performs a binary search and is restricted to testing only equal (=) conditions. It cannot evaluate other relational operators like greater than or less than.

Multiple choice technology databases
  1. <procedure id="swapEmailAddresses" parameterName="swapParameters" > {call swap_email_address (?, ?)} </procedure>

  2. <procedure id="swapEmailAddresses" parameterMap="swapParameters" > {call swap_email_address (?, ?)} </procedure>

  3. <procedure name="swapEmailAddresses" parameterMap="swapParameters" > {call swap_email_address (?, ?)} </procedure>

  4. <procedure propertyName="swapEmailAddresses" parameterMap="swapParameters" > {call swap_email_address (?, ?)} </procedure>

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

In iBATIS stored procedures, the correct attribute for parameter mapping is 'parameterMap'. The 'parameterName' attribute doesn't exist in the iBATIS DTD. The procedure uses the parameterMap named 'swapParameters' to map output parameters correctly.