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
  1. SELECT SYSDATE+1 FROM DUAL

  2. SELECT TO_CHAR(SYSDATE+1,'MM/dd/yyyy HH:mm:ss') FROM DUAL

  3. SELECT SYSDATE+1/86400 FROM DUAL

  4. SELECT (SYSDATE+1)/86400 FROM DUAL

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

This answer is correct. SYSDATE+1 will give the next date and time component. But SYSDATE+1/86400 will give the next second of the current date and current hour and current minute because in a given day, there are 86400 seconds, i.e. 24 * 60 * 60 seconds. Hence 1/86400 will give you the current second. When the sysdate is added to 1/86400, it gives the next second of the current date, hour and minute.

Multiple choice
  1. Select ENAME, SAL, SAL* 0.1 10% INCREASED SAL from emp;

  2. Select ENAME, SAL, SAL* 10 10% INCREASED SAL from emp;

  3. Select ENAME, SAL, SAL* 0.01 '10% INCREASED SAL' from emp;

  4. Find ENAME, SAL, SAL* 0.1 10% INCREASED SAL from emp;

  5. Seek ENAME, SAL, SAL* 0.1 10% INCREASED SAL from emp;

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

This is the correct SQL statement to find the specified fields with the virtual column.

Multiple choice
  1. The line numbers reported match the line numbers you see in your text editor.

  2. SQL*Plus will automatically show the errors to you.

  3. To see the errors, enter SHOW ERRORS in SQL*Plus.

  4. If there are no syntax errors, you will receive the message "NO ERRORS."

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

When a PL/SQL procedure has compilation errors, SQL*Plus displays a warning message but does not automatically show the errors. The DBA or developer must explicitly execute the 'SHOW ERRORS' command to view the compilation error details, including line numbers and error messages. Option A is incorrect because SQL*Plus renumbers lines starting from 1, not matching your editor. Option B is false because errors aren't shown automatically. Option D is incorrect - successful compilation produces no warning message.