Computer Knowledge
Database and SQL
4,213 QuestionsMaster 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
Reveal answer
Fill a bubble to check yourself
Reveal answer
Fill a bubble to check yourself
Reveal answer
Fill a bubble to check yourself
Reveal answer
Fill a bubble to check yourself
A relational schema for a train reservation database is given below: Passenger (pid, pname, age)
Table: passenger
| pid | pname | Age |
|---|---|---|
| 0 | Sachin | 65 |
| 1 | Rahul | 66 |
| 2 | Sourav | 67 |
| 3 | Anil | 69 |
Table: Reservation
| pid | class | tid |
|---|---|---|
| 0 | AC | 8200 |
| 1 | AC | 8201 |
| 2 | SC | 8201 |
| 5 | AC | 8203 |
| 1 | SC | 8204 |
| 3 | AC | 8202 |
What pids are returned by the following SQL query for the above instance of the tables?
SELECT pid
FROM Reservation
WHERE class 'AC' AND
EXISTS (SELECT *
FROM Passenger
WHERE age 65 > AND
Passenger. pid = Reservation. pid)
Reveal answer
Fill a bubble to check yourself
Reveal answer
Fill a bubble to check yourself
Reveal answer
Fill a bubble to check yourself
Database table by name Loan_Records is given below.
| Borrower | Bank_Manager | Loan_Amount |
|---|---|---|
| Ramesh | Sunderajan | 10000.00 |
| Suresh | Ramgopal | 5000.00 |
| Mahesh | Sunderajan | 7000.00 |
What is the output of the following SQL query?
SELECT count(*)
FROM(
(SELECT Borrower. Bank_Manager FROM Loan_Records) AS S
NATURAL JOIN
(SELECT Bank_Manager, Loan_Amount FROM Loan_Records) AS T
);
Reveal answer
Fill a bubble to check yourself
Reveal answer
Fill a bubble to check yourself
Reveal answer
Fill a bubble to check yourself
Reveal answer
Fill a bubble to check yourself
Reveal answer
Fill a bubble to check yourself
Reveal answer
Fill a bubble to check yourself
Reveal answer
Fill a bubble to check yourself
Reveal answer
Fill a bubble to check yourself

After executing the given query, the output would be

