0% found this document useful (0 votes)
2 views4 pages

SQL Questions

The document outlines the essential skills and knowledge required for an Analytics candidate, emphasizing the importance of verifying query results to avoid incorrect data impacting business intelligence. It includes sample technical interview questions covering SQL concepts such as joins, data types, constraints, and commands. Additionally, it highlights the differences between various SQL operations, including DELETE vs. TRUNCATE and the use of UNION, MINUS, and INTERSECT.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

SQL Questions

The document outlines the essential skills and knowledge required for an Analytics candidate, emphasizing the importance of verifying query results to avoid incorrect data impacting business intelligence. It includes sample technical interview questions covering SQL concepts such as joins, data types, constraints, and commands. Additionally, it highlights the differences between various SQL operations, including DELETE vs. TRUNCATE and the use of UNION, MINUS, and INTERSECT.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Potential Analytics candidate hire should have good command over

checking incorrect data and perform cross verification of any query


result. Unlike in web development developers often get bugs that can
be easily detected but in case of Query if the query is producing
results does not mean the query result is correct.
Incorrect query result is highly dangerous for analytics because whole
business intelligence may go wrong

Successful execution of a query does not led to correct results if tables are
not joined correctly and conditions are not applied correctly.

Skill needed - Attention to details, Ability to question output of


query by cross verification.

Sample Question to be asked with eTechnical Interview

What do you mean by table and field in SQL?

What are joins in SQL?


Inner join: Inner Join in SQL is the most common type of join. It is
used to return all the rows from multiple tables where the join
condition is satisfied.

Left Join: Left Join in SQL is used to return all the rows from the left
table but only the matching rows from the right table where the join
condition is fulfilled.

Right Join: Right Join in SQL is used to return all the rows from the
right table but only the matching rows from the left table where the join
condition is fulfilled.
Full Join: Full join returns all the records when there is a match in any
of the tables. Therefore, it returns all the rows from the left-hand side
table and all the rows from the right-hand side table.

What is the difference between CHAR and VARCHAR2 datatype in


SQL?
Both Char and Varchar2 are used for characters datatype but
varchar2 is used for character strings of variable length whereas Char
is used for strings of fixed length. For example, char(10) can only
store 10 characters and will not be able to store a string of any other
length whereas varchar2(10) can store any length i.e 6,8,2 in this
variable.

What is the Primary key?

What are Constraints?


Constraints in SQL are used to specify the limit on the data type of the
table. It can be specified while creating or altering the table statement.
The sample of constraints are:
NOT NULL
CHECK
DEFAULT
UNIQUE
PRIMARY KEY
FOREIGN KEY

What is a UNIQUE constraint?


The UNIQUE Constraint prevents identical values in a column from
appearing in two records. The UNIQUE constraint guarantees that
every value in a column is unique.
What is the difference between DELETE and TRUNCATE
statements?
DELETE
Delete command is used to delete a row in a table.
You can rollback data after using the delete statement.
It is a DML command.
It is slower than truncate statement.

TRUNCATE
Truncate is used to delete all the rows from a table.
You cannot rollback data.
It is a DDL command.
It is faster.

What is a Unique key?


Uniquely identifies a single row in the table.
Multiple values allowed per table.
Null values allowed.

What are UNION, MINUS and INTERSECT commands?


The UNION operator is used to combine the results of two tables while
also removing duplicate entries.
The MINUS operator is used to return rows from the first query but not
from the second query.
The INTERSECT operator is used to combine the results of both
queries into a single row.
Before running either of the above SQL statements, certain
requirements must be satisfied –
Within the clause, each SELECT query must have the same amount
of columns.
The data types in the columns must also be comparable.
In each SELECT statement, the columns must be in the same order.
What is the difference between NOW() and CURRENT_DATE()?
NOW() returns a constant time that indicates the time at which the
statement began to execute. (Within a stored function or trigger,
NOW() returns the time at which the function or triggering statement
began to execute.
The simple difference between NOW() and CURRENT_DATE() is that
NOW() will fetch the current date and time both in format
‘YYYY-MM_DD HH:MM:SS’ while CURRENT_DATE() will fetch the
date of the current day ‘YYYY-MM_DD’.

You might also like