Вы находитесь на странице: 1из 2

SQL Important Questions:

This the material for SQL profile. I am assuming this is sufficient material for
SQL preparation. All the interview questions can be covered from these question
You can save these questions for future purpose.
1> What is DBMS? & What is RDBMS and difference between both.
2> What is the difference between SQL and MySQL or SQL Server?
3> What is the difference between SQL and PL/SQL?
4> What are various DDL, DML,DCL commands in SQL? Give brief description of thei
r purposes.
5> Is a NULL value same as zero or a blank space? If not then what is the differ
6> What is constraints in sql and how many constraints are in SQL
Not Null ?
Unique Key (prepare Unique key in details)
Primary Key(prepare Unique key in details)
Foreign Key(prepare Unique key in details)
Check Constraint(prepare Unique key in details)
Index(prepare Unique key in details)
Default(prepare Unique key in details)
7> What is difference between Delete , drop and truncate
8> What is difference between where and having clause
9> What is join and types of join with example?
10> What is Union and Union ALL, difference between both
11> What are the properties and different Types of Sub-Queries?
12> Which TCP/IP port does SQL Server run on? How can it be changed? Answer: 143
13> What is index and types of index
14> What is ACID property in database?
15> What is the difference among NULL value, zero and blank space?
16> Which are the different case manipulation functions in SQL?
17> What is the usage of NVL function?
18> Which function is used to return remainder in a division operator in SQL?
19> What is the usage of DISTINCT keyword?
20> What is Normalization and type of normalizations?
21> What is SQL Injection?
22> What is denormalization?
23> What is a View?
24> What is a Cursor? And type of cursor
25> What are local and global variables and their differences?
26> . What is Datawarehouse?
27> What is OLTP and OLAP and difference between both?
28> What is star Schema and snowflake Schema and difference between
29> What is Union, minus and Interact commands?
30> What is an ALIAS command?
31> What are aggregate and scalar functions?
32> What is the command used to fetch first 5 characters of the string?
Answer: Select SUBSTRING(StudentName,1,5) as studentname from student
33> How to fetch alternate records from a table?
Answer: Select studentId from (Select rowno, studentId from student) where mod(r
34> How to fetch common records from two tables?
Answer: Select studentID from student. <strong>INTERSECT </strong> Select Studen
tID from Exam
35> How can you create an empty table from an existing table?
Answer: Select * into studentcopy from student where 1=2
36> SQL Query to find second highest salary of Employee ?
Answer: select MAX(Salary) from Employee WHERE Salary NOT IN (select MAX(Salary)
from Employ
37> SQL Query to find Max Salary from each department.
Answer:SELECT DeptID, MAX(Salary) FROM Employee GROUP BY DeptID
38> Write SQL Query to display the current date.
Answer:SELECT GetDate();
39> Write an SQL Query to check whether date passed to Query is the date of give
n format or not.
Answer: SELECT ISDATE('1/08/13') AS "MM/DD/YY";
40> Write an SQL Query to print the name of the distinct employee whose DOB is b
etween 01/01/1960 to 31/12/1975
Answer:SELECT DISTINCT EmpName FROM Employees WHERE DOB BETWEEN 01/01/1960 AND 31/1
2/1975 ;
41> Write SQL Query to find duplicate rows in a database? and then write SQL que
ry to delete them?
Answer: SELECT * FROM emp a WHERE rowid = (SELECT MAX(rowid) FROM EMP b WHERE a.
And To delete:
DELETE FROM emp a WHERE rowid != (SELECT MAX(rowid) FROM emp b WHERE a.empno=b.e
42> What is a Composite Key ?
43> What are COMMIT and ROLLBACK in SQL?
44> What is RANK function?
45> What is a materialized view?
46> What is the difference between the NVL and the NVL2 functions?
47> What is the difference between cross joins and natural joins?
48> What is the purpose of the MERGE statement in SQL?
49> What is the difference between VARCHAR2 AND CHAR datatypes?
50> What is clone Table
51> What is the difference between the RANK() and DENSE_RANK() functions? Provid
e an example.