SQL INTERVIEW QUESTION-PART 1

Welcome to your SQL INTERVIEW QUESTION-PART 1

1. What does INSTR() and SUBSTRQ return?
2. What is the usage of LPAD () and RPAD() functions?
3. What is difference between EXIST and IN when using in sub queries?
4. What is differences between single row function and multi row function?
5. What is the difference between IN and = operator?
  • = operator accepts only 1 value
IN Operator can accept more than 1 value.
6. What is a DUAL table and why do we need it in DB?
7. What are pseudo columns?
8. What is difference between Delete and Truncate and Which is faster?
9. Identify the various kinds of joins?
10. 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;

11. Difference between HAVING and WHERE clause?
12. What types of Date Datatypes exist?

 

  • DATE
  • TIMESTAMP
  • TIMESTAMP WITH TIME ZONE
TIMESTAMP WITH LOCAL TIME ZONE
13. What is the difference between DATE and TIMESTAMP datatype?
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