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
-
It can view the data without storing the data into the object.
-
It can hide the complexity of data.
-
It restricts the access of a table so that nobody can insert the rows into the table.
-
It can use DML operations on the views.
-
It joins two or more tables and shows it as one object to a user.
D
Correct answer
Explanation
This is the correct answer as it cannot use DML operations on the views.
-
CONCAT(), AND
-
CONCAT(), +
-
CONCAT(), ||
-
CONCAT()
-
CONCAT(), -
B
Correct answer
Explanation
In SQL server, CONCAT(), + are used to concatenate two strings in the results.
Example:
SELECT Region_Name + ' ' + Store_Name FROM Geography WHERE Store_Name = 'Boston';
Output:
'East Boston'
-
employee’s salary is greater than 4999
-
employee’s department is accounts
-
employee’s department is accounts and employee’s salary is greater than 5000
-
employee’s department is accounts and employee’s salary is greater than 4999
-
total salary of employee is zero
D
Correct answer
Explanation
This option is correct because the employee’s department is accounts and employee’s salary is greater than 4999.
-
SQL intersect
-
SQL union
-
SQL in
-
SQL join
-
SQL exists
E
Correct answer
Explanation
The 'SQL exists' simply tests whether the inner query returns any row. If it does, then the outer query proceeds. If not, the outer query does not execute, and the entire SQL statement returns nothing.
-
Select * from employee where empid = 505
-
Select empid from employee where empname = John
-
Select empid from employee
-
Select empid where empid = 509 and lname = John
-
Select * from employee where empid = 305
D
Correct answer
Explanation
This option is correct because the query does not have 'from' clause which specifies the relation/table from which the values have to be selected.
-
SQL Inner Join
-
SQL Left Outer Join
-
SQL Right Outer Join
-
SQL Full Outer Join
-
SQL Upper Join
D
Correct answer
Explanation
SQL Full Outer Join: It returns all rows when there is a match in one of the tables.
-
SQL DELETE
-
SQL DROP TABLE
-
SQL DROP INDEX
-
SQL DROP DATABASE
-
SQL TRUNCATE TABLE
E
Correct answer
Explanation
The SQL TRUNCATE TABLE statement is used to delete only the data inside a table and not the table itself.
-
SQL server
-
MS access
-
Oracle
-
MySQL
-
D-link
C
Correct answer
Explanation
Oracle does not have an ISNULL () function, instead it uses the NVL () function.
-
SQL alter
-
SQL modify
-
SQL drop
-
SQL delete
-
SQL update
A
Correct answer
Explanation
The SQL alter table statement is used to add, delete, or modify columns in an existing table.
-
return all customer names without duplicate values
-
return all customer names from the depositor table
-
return all customer names from borrower table
-
return all customer names if names available in depositor table match with borrower table
-
return all customer names with duplicate values
A
Correct answer
Explanation
The union operator is used to combine the result-set of two or more SELECT statements.
The union operator selects only distinct values by default.
Here, it will return the customer names, who all are listed in depositor table and borrower table without repeating the names.
-
procedural
-
non-procedural
-
imperative
-
non-imperative
-
None of these
C
Correct answer
Explanation
SQL is a set-based declarative query language or an imperative query language.
-
relational algebra
-
tuple relational calculus
-
domain relational calculus
-
Both 1 and 2
-
Both 1 and 3
D
Correct answer
Explanation
This option is correct because SQL DML includes a query language based on relational algebra and tuple relational calculus.
-
Select * from tblemployee where city like ‘mi’
-
Select * from tblemployee where city ‘mi%’
-
Select * from tblemployee where city ‘‘mi%’’
-
Select * from tblemployee where city like ‘mi%’
-
Select * from tblemployee where city like ‘%mi’
D
Correct answer
Explanation
This option is correct because 'Select * from tblemployee where city like ‘mi%’ is the correct statement.
-
DBMS_OUTPUT.GET_LINE (line OUT VARCHAR2, status OUT INTEGER);
-
DBMS_OUTPUT.GET_LINES (lines OUT CHARARR, numlines IN OUT INTEGER);
-
DBMS_OUTPUT.PUT(item IN VARCHAR2);
-
DBMS_OUTPUT.PUT_LINE(item IN VARCHAR2);
-
DBMS_OUTPUT.DISABLE;
B
Correct answer
Explanation
It retrieves an array of lines from the buffer.
-
A CREATE TABLE statement is issued
-
A COMMIT or a ROLLBACK statement is issued
-
A DCL statement, such as a GRANT statement is issued
-
A DML statement fails
-
An UPDATE statement is issued
D
Correct answer
Explanation
This is correct as a ROLLBACK is automatically performed for undoing that DML statement.