SQL INTERVIEW QUESTION-PART 1

Welcome to your SQL INTERVIEW QUESTION-PART 1

1. What is difference between EXIST and IN when using in sub queries?
2. What is a DUAL table and why do we need it in DB?
3. What are pseudo columns?
4. What types of Date Datatypes exist?

 

  • DATE
  • TIMESTAMP
  • TIMESTAMP WITH TIME ZONE
TIMESTAMP WITH LOCAL TIME ZONE
5. What is the usage of LPAD () and RPAD() functions?
6. What is the difference between IN and = operator?
  • = operator accepts only 1 value
IN Operator can accept more than 1 value.
7. What is differences between single row function and multi row function?
8. What is the difference between DATE and TIMESTAMP datatype?
9. What are Conversion functions?

 

Conversion functions are useful to typecast data from one datatype to other.

SELECT first_name,

TO_CHAR (hiredate, ’MONTH DD, YYYY') HIRE_DATE,

TO_CHAR (salary, '$99999.99') Salary FROM employees

SELECT TO_NUMBER('1210.73', '9999.99') FROM DUAL;

SELECT TO DATE('January 15, 2016', 'Month dd, YYYY') FROM DUAL;

10. Difference between HAVING and WHERE clause?
11. What is difference between Delete and Truncate and Which is faster?
12. What does INSTR() and SUBSTRQ return?
13. Identify the various kinds of joins?
14. What is the difference between CHAR and NCHAR datatype?

NCHAR is used to store fixed length Unicode data. It is often used to store data in different languages.

CHAR is used to store fixed-length character data.

When data is stored using CHAR, it takes n bytes while NCHAR takes 2n bytes.

Author: CloudVikas