SQL Interview Questions and Answers
SQL Interview Questions and Answers
indexing is used for faster search or to retrieve data faster from various table. Schema
containing set of tables, basically schema means logical separation of the database. View is
crated for faster retrieval of data. It's customized virtual table. we can create a single view
of multiple tables. Only the drawback is..view needs to be get refreshed for retrieving
updated data.
Which system table contains information on constraints on all the tables created ?
yes,
USER_CONSTRAINTS,
system table contains information on constraints on all the tables created
Explain normalization ?
Normalisation means refining the redundancy and maintain stablisation. there are four types
of normalisation :
first normal forms, second normal forms, third normal forms and fourth Normal forms.
How to find out the database name from SQL*PLUS command prompt?
Select * from global_name;
This will give the datbase name which u r currently connected to.....
What is the difference between SQL and SQL Server ?
SQLServer is an RDBMS just like oracle,DB2 from Microsoft
whereas
Structured Query Language (SQL), pronounced "sequel", is a language that provides an
interface to relational database systems. It was developed by IBM in the 1970s for use in
System R. SQL is a de facto standard, as well as an ISO and ANSI standard. SQL is used to
perform various operations on RDBMS.
What is diffrence between Co-related sub query and nested sub query?
Correlated subquery runs once for each row selected by the outer query. It contains a
reference to a value from the row selected by the outer query.
Nested subquery runs only once for the entire nesting (outer) query. It does not contain
any reference to the outer query row.
For example,
Correlated Subquery:
select e1.empname, e1.basicsal, e1.deptno from emp e1 where e1.basicsal = (select
max(basicsal) from emp e2 where e2.deptno = e1.deptno)
Nested Subquery:
select empname, basicsal, deptno from emp where (deptno, basicsal) in (select deptno,
max(basicsal) from emp group by deptno)
2. _ ( underscore )
% means matches zero or more characters and under score means mathing exactly one
character
1) It is a unique key on which all the other candidate keys are functionally dependent
Disadvantage
1) There can be more than one keys on which all the other attributes are dependent on.
Foreign Key
Advantage
1)It allows refrencing another table using the primary key for the other table
Which date function is used to find the difference between two dates?
datediff
for Eg: select datediff (dd,'2-06-2007','7-06-2007')
output is 5