SQL Interview Questions For A BA Job
SQL Interview Questions For A BA Job
SQL Interview Questions For A BA Job
Call - +918850528364
TrainSmart Academy: +918850528364
Leading Business Analysis Training provider for ECBA / CCBA / CBAP
Business Analyst is nothing but the bridge between Technical team and Customers. If they
know the SQL and database structure which was designed by technical team it is easy for
them to take decisions acccordingly. Its easy for them to understand design of the
database.
Question 3: What are different system queries needs to know for Business
Analyst?
There are so many types of System queries needs to know every developer, Business
Analyst E.t.c. I would like to visit following link which will give you information about
different system tables:
https://www.complexsql.com/oracle-system-tables/
To Find out the constraint information in SQL following 2 queries are important:
Queries:
Question 5: What is query to find out maximum and minimum marks in SQL?
Union
Set operators are nothing but the operators which are used to connect two tables and
fetch the records from the two tables.We need to follow one condition that the table set
1 columns and table set 2 columns are same and its datatype must be same.SQL Set
Operators combines the result of 2 queries or components on to the single result.
1. Union
2. Union all
3. Intersect
4. Minus
2.User can join the multiple instances of same table together to complete the specific
requirement.
3.Self-joins are used to compare values in a column with other values in the same column
in the same table.
4.The Self join is used to obtain the running count and running totals.
5.Real Example:
The self join is used to find out the employee and his manager name in same employee
table.
SQL Join:
SQL JOIN allows us to “lookup” records on other table based on the given conditions
between two tables. For example, if we have the department ID of each employee, then
we can use this department ID of the employee table to join with the department ID of
department table to lookup department names.
Example:
UNION
DDL stands for Data Definition Language.Following are the different DDL statements:
Statement Description
DROP Deletes an entire table, a view of a table or other object in the database.
Join is nothing but connecting 2 tables to fetch the records from 2 or more different
tables.There are following types of joins in SQL:
Joins in SQL
1.Inner join:
Inner join retreives the records which are common between 2 or more tables.
2.Outer join:
Outer join retrieves the common records from the table as well as uncommon records
from Left or right table.
When user needs to fetch all data from right table and common records from left and right
table then the join is called as right outer join.
1.Normal index
2.Unique Index
3.Bit Map Index
4.Composite Index
5.B-Tree Index(Oracle considered Normal indexes as B-Tree Indexes)
6.Function Based Index
7.Clustered Index
8.Non-Clustered Index.
1.NVL :
NVL function substitutes a value when a null value is encountered.
2.NVL2 :
NVL2 substitutes a value when a null value is encountered as well as when a non-null
value is encountered.
3.NULLIF:
NULLIF function compares expr1 and expr2. If expr1 and expr2 are equal, the NULLIF
function returns NULL. Otherwise, it returns expr1.
TrainSmart Academy: +918850528364
Leading Business Analysis Training provider for ECBA / CCBA / CBAP
SQL scalar functions are the functions whose input range is one dimensional and which
returns the single output for each row.SQL Scalar functions returns value of every row
which we are used in query to process.
Negation Operators are operators which has negation condition like ‘Not’ Condition.
NOT Operator:
Not operator is negation operator which reverses the meaning of logical operator.The Not
operator is used before Logical operator like Not In,Not Exist etc.
Example:
Question 16: Explain Rank function in detail with real life example.
Rank function is used as aggregate function to return the rank of rows in the table within
group of rows.If someone needs to find out the rank of specific row in the table then we
will use the rank function.
Question: Find out Rank of Employee whose Department is OBIEE and Name is Rokul?
There is no difference between unique and distinct keywords apart from one difference.
unique is applied before insertion and retrival. It consists of non duplicate values.if
unique constraint is given it does not take duplicate values. distinct is used in retrieval it
gives the suppressed row(ex if two rows are same it will show single row and non
duplicate row) therefore distinct is the combination of suppressed duplicate and non
duplicate rows. Specify DISTINCT or UNIQUE if you want Oracle to return only one copy
of each set of duplicate rows selected (these two keywords are synonymous). Duplicate
rows are those with matching values for each expression in the select list.
So there is no functional difference between Unique and distinct both have same
functionalities.
TrainSmart Academy: +918850528364
Leading Business Analysis Training provider for ECBA / CCBA / CBAP
Query :
select case when null=null then ‘Raman’ Else ‘Raghav’ from dual;
Answer:
In SQL null value is not equal to itself.So null=null is false and the output of above query
is ‘Raghav’.
Correlated Query is nothing but the subquery whose output is depending on the inner
query used in that query.Correlated query is the query which is executed after the outer
query is executed.The outer query is always dependent on inner query.The approach of
the correlated subquery is bit different than normal subqueries.In normal subqueries the
inner queries are executed first and then the outer query is executed but in Correlated
Subquery outer query is always dependent on inner query so first outer query is executed
then inner query is executed.Correlated Subqueries always uses operator like Exist,Not
Exist,IN,Not IN.
“Correlated Queries are also called as Synchronized queries…”
Materialized view is also a logical structure which is stored physically on the disc.Like a
view in Materialized view we are using simple select statement to create it.You should
have create materialized view privileges to create a materialized view.Definition of
materialized view(called as MV) has been stored in databases.Materialized views are
useful in Data-warehousing concepts.
These are some most important SQL Interview Questions for Business Analyst with its
answers. I hope these queries will help you.