Computer Knowledge

Database and SQL

3,929 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
  1. a) UPPER

  2. b) LOWER

  3. c) FIRSTUPPER

  4. d) None

  5. a) UPPER b) LOWER c) FIRSTUPPER

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

The Force Case property on Business Component Fields accepts three valid values: UPPER (converts to uppercase), LOWER (converts to lowercase), and FIRSTUPPER (capitalizes first letter, rest lowercase). These are the only valid options for forcing case on field values. Options A, B, and C list individual valid values, and option E correctly combines all three. 'None' is not a valid value for this property.

Multiple choice technology
  1. a) PreDefault

  2. b) Post Default

  3. c) Validation

  4. d) Required

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

PostDefault property in Siebel Business Components automatically assigns a value to a field only if the user hasn't entered one, and this assignment happens during the PreWrite event before the record is inserted into the database. PreDefault assigns values before UI rendering, while PostDefault works after user interaction but before database commit.

Multiple choice technology
  1. a) TRUE

  2. b) FALSE

  3. c) None

  4. d) None

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

The Owner Delete property in Siebel Business Components, when set to TRUE, restricts record deletion to only the owner (creator) of that record. This security feature ensures that users cannot delete records owned by other users, protecting data integrity and ownership rights.

Multiple choice technology architecture
  1. Every entity must have a primary key

  2. It is not necessary to define primary key for an Entity

  3. @Primary annotation is used for denoting a simple primary key

  4. All the above

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

Every entity in JPA/EJB must have a primary key that uniquely identifies each persistent instance. This is a fundamental requirement of the entity specification - primary keys can be simple or composite, but an entity cannot exist without one. Option B is incorrect because primary keys are mandatory.

Multiple choice technology architecture
  1. Update Employee set salary = salary * 1.5 and grade=’Promo’ where salary < 10000;

  2. Update Employee set salary = salary * 1.5, grade=’Promo’ where salary < 10000;

  3. Update table Employee set salary = salary * 1.5, grade=’Promo’ where salary < 10000;

  4. Update table Employee set salary = salary * 1.5 and grade=’Promo’ where salary < 10000;

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

In SQL UPDATE statements, multiple column assignments must be separated by commas, not the AND keyword. The correct syntax is 'UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition'. Option A incorrectly uses 'and' instead of a comma. Options C and D incorrectly include 'table' keyword after UPDATE.

Multiple choice technology architecture
  1. INSERT

  2. CREATE

  3. UPDATE

  4. DELETE

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

Data Definition Language (DDL) commands define or modify database structures like tables, indexes, and schemas. CREATE is a DDL command used to create database objects. INSERT, UPDATE, and DELETE are Data Manipulation Language (DML) commands that manipulate the data within those structures.

Multiple choice technology architecture
  1. PreparedStatement

  2. ParameterizedStatement

  3. ParameterizedStatement and CallableStatement

  4. All kinds of Statements (i.e. which implement a sub interface of Statement)

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

PreparedStatement is specifically designed to execute parameterized queries safely and efficiently. It precompiles the SQL statement with placeholders (?) and allows setting parameters separately, preventing SQL injection. Regular Statement doesn't support parameterized queries. CallableStatement is for stored procedures.

Multiple choice technology architecture
  1. The executeUpdate method returns all the rows that were affected

  2. The executeUpdate method returns the no. of rows that were affected

  3. Depends , as there is more than one version of this method with different return types

  4. None

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

The executeUpdate method in JDBC returns an integer representing the number of rows affected by the SQL operation (INSERT, UPDATE, DELETE). It doesn't return the actual row data - just a count. For SELECT queries, you'd use executeQuery which returns a ResultSet.

Multiple choice technology web technology
  1. Opening the administrator workbench

  2. Changing the query properties within the query designer

  3. Double-clicking on the characteristic in the query definition

  4. Creating a calculated key figure

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

Double-clicking on a characteristic in the query definition opens the restriction dialog where you can specify values, ranges, or variables to limit the characteristic. Option A (administrator workbench) is a general tool, not a specific action. Option B (changing query properties) affects the query globally, not individual characteristics. Option D (calculated key figure) creates a new key figure rather than restricting an existing characteristic.

Multiple choice technology databases
  1. Structured Question Language

  2. Strong Question Language

  3. Structured Query Language

  4. Structured Query Limited

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

SQL stands for Structured Query Language, a standard language designed for managing database records and executing queries. The other options are incorrect variations using words like 'Question', 'Strong', or 'Limited' instead of the standard 'Query' and 'Language'.

Multiple choice technology databases
  1. FETCH

  2. GET

  3. SELECT

  4. EXTRACT

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

SELECT is the SQL statement used to retrieve/extract data from database tables. It's the most fundamental SQL query operation. FETCH is used in cursors (not a standalone data retrieval statement), GET and EXTRACT are not standard SQL keywords for retrieving data from tables.

Multiple choice technology databases
  1. SELECT Persons.FirstName

  2. EXTRACT FirstName FROM Persons

  3. SELECT FirstName FROM Persons

  4. SELECT FROM FirstName IN Persons

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

Selecting a column requires the SELECT columnName FROM tableName syntax. Therefore, SELECT FirstName FROM Persons is correct. SELECT Persons.FirstName lacks the mandatory FROM clause, EXTRACT is not the correct command, and the IN syntax is invalid for basic column retrieval.