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
-
a) UPPER
-
b) LOWER
-
c) FIRSTUPPER
-
d) None
-
a) UPPER b) LOWER c) FIRSTUPPER
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.
-
a) PreDefault
-
b) Post Default
-
c) Validation
-
d) Required
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.
-
a) TRUE
-
b) FALSE
-
c) None
-
d) None
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.
-
Every entity must have a primary key
-
It is not necessary to define primary key for an Entity
-
@Primary annotation is used for denoting a simple primary key
-
All the above
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.
-
Update Employee set salary = salary * 1.5 and grade=’Promo’ where salary < 10000;
-
Update Employee set salary = salary * 1.5, grade=’Promo’ where salary < 10000;
-
Update table Employee set salary = salary * 1.5, grade=’Promo’ where salary < 10000;
-
Update table Employee set salary = salary * 1.5 and grade=’Promo’ where salary < 10000;
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.
-
INSERT
-
CREATE
-
UPDATE
-
DELETE
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.
-
PreparedStatement
-
ParameterizedStatement
-
ParameterizedStatement and CallableStatement
-
All kinds of Statements (i.e. which implement a sub interface of Statement)
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.
-
The executeUpdate method returns all the rows that were affected
-
The executeUpdate method returns the no. of rows that were affected
-
Depends , as there is more than one version of this method with different return types
-
None
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.
-
Opening the administrator workbench
-
Changing the query properties within the query designer
-
Double-clicking on the characteristic in the query definition
-
Creating a calculated key figure
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.
-
Structured Question Language
-
Strong Question Language
-
Structured Query Language
-
Structured Query Limited
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'.
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.
-
UPDATE
-
MODIFY
-
SAVE AS
-
SAVE
A
Correct answer
Explanation
UPDATE is the correct SQL statement for modifying existing data in database tables. You use UPDATE with SET to change column values. MODIFY, SAVE AS, and SAVE are not standard SQL statements for updating table data.
-
REMOVE
-
COLLAPSE
-
DELETE
-
REMOVE ALL
C
Correct answer
Explanation
DELETE is the SQL statement used to remove rows from database tables. You can delete specific rows using a WHERE clause or all rows (without WHERE). REMOVE, COLLAPSE, and 'REMOVE ALL' are not valid SQL keywords for deleting data.
-
ADD NEW
-
ADD RECORD
-
INSERT NEW
-
INSERT INTO
D
Correct answer
Explanation
INSERT INTO is the standard SQL command for adding new records to a table. The syntax requires specifying the table name after the keywords, making INSERT INTO the only valid option among the choices.
-
SELECT Persons.FirstName
-
EXTRACT FirstName FROM Persons
-
SELECT FirstName FROM Persons
-
SELECT FROM FirstName IN Persons
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.