0% found this document useful (0 votes)
82 views11 pages

SQL World

oracle dba scripts
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)
82 views11 pages

SQL World

oracle dba scripts
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
You are on page 1/ 11

8/17/2018 Interview Questions for TCS | SQL Interview Questions for TCS | Interview Questions Asked in TCS | TCS

in TCS | TCS Interview Questions

 HOME  ABOUT US  PRIVACY POLICY  CONTACT US Search the site 

SQL WORLD
Get Your SQL Query Fast and Furious..

 HOME  SQL QUERIES  ORACLE  ORACLE BI  UNIX

 POSTGRESQL  INTERVIEW Q/A

 HOME  SQL QUERIES  ORACLE  ORACLE BI  UNIX

 POSTGRESQL  INTERVIEW Q/A

Interview Questions for TCS | SQL Search:

Interview Questions for TCS | Interview


Questions Asked in TCS | TCS Interview
Questions
 March 27, 2017 |  SQL Interview Questions

SUBSCRIBE HERE TO GET


INTERVIEW QUESTIONS OF
20$ WORTH
Interview Questions for TCS:
Email address:
I have studied lot of stu related to interview questions for TCS
SUBSCRIBE FOR FREE
and i am presenting the set of interview questions which are most
frequently asked in TCS interviews.In my previous articles i have
added the most frequently asked interview questions for Tech Sign up
Mahindra,Oracle corporation and IBM. In This article i will explain
the Interview Questions for TCS.These interview questions are very
important for preparation for any interview but most of the
LIKE OUR WEBSITE AT
questions are asked in TCS interview.
FACEBOOK
Following are Some most important questions that may ask in TCS
interviews:

SPONSORED SEARCHES

A Questions and Answers

Customer Database

http://www.complexsql.com/interview-questions-for-tcs/ 1/11
8/17/2018 Interview Questions for TCS | SQL Interview Questions for TCS | Interview Questions Asked in TCS | TCS Interview Questions

Complexsql.com
297 likes

Like Page

Be the first of your friends to like this


1.What are di erent database Environments used in any project?

Answer:
Categories
The Project to project database environment varies.But the BI Tutorials
following is basic environment structure used for projects. Data Mining
Oracle 18c
Oracle Errors
PLSQL Tutorials
Roles and Responsibilities
SQL Complex Queries
SQL Di erence Between
SQL Interview Questions
SQL Interview Questions For
Freshers
SQL Joins
SQL Performance Tuning
SQL Tutorials
1.Development Environment:
Unix Interview Questions

In Development Environment all developer works and Unix Tutorials

development work is been done on development environment.


Translate in Your Language
2.Test Environment:
Select Language
Developers does not have access of test environment.After Powered by Translate
development is done the code is migrated to Test
Environment.Testing team is working on Test environment and
Top Posts
execute black box as well as white box test cases on this
Environment.Sometimes System Integration Testing (SIT) is also 20 SQL Queries for
interview | Complex SQL
done on this Environment.
Queries for Interview

3.UAT Environment: What is ROWID and


ROWNUM in SQL? |
Di erence Between
UAT stands for User Acceptance Testing.On this Environment the
ROWID & ROWNUM?
Customer side testers tests the software and executes User
Acceptance Test Cases.

http://www.complexsql.com/interview-questions-for-tcs/ 2/11
8/17/2018 Interview Questions for TCS | SQL Interview Questions for TCS | Interview Questions Asked in TCS | TCS Interview Questions

4.Performance Testing Environment:

On this environment the performance tester tests all performance


related issues on this environment. This environment contains
very huge data and performance tester will try to break the system
using that big data.

5.Production Environment:

On this Environment actual user works and uses the software.

2.What is Null in SQL?

Answer:

A NULL value in a table is a value in a eld that appears to be


blank, which means a eld with a NULL value is a eld with no
value.

It is very important to understand that a NULL value is di erent


than a zero value or a eld that contains spaces. A eld with a
NULL value is one that has been left blank during record creation.

3. What is not null constraint?

Answer:

By default, a table column can hold NULL values. The NOT NULL
constraint enforces a column to NOT accept NULL values.

The NOT NULL constraint enforces a eld to always contain a


value. This means that you cannot insert a new record, or update a
record without adding a value to this eld.

CLICK HERE TO GET MORE INFORMATION ABOUT DIFFERENT


CONSTRAINTS OF SQL

4.What is Unique key constraint?(90% asked in Interview Questions


for TCS)

Answer:

The UNIQUE Constraint uniquely identi es each record in a


database table.

The UNIQUE and PRIMARY KEY Constraints both provide a


guarantee for Uniqueness for a column or set of columns.

http://www.complexsql.com/interview-questions-for-tcs/ 3/11
8/17/2018 Interview Questions for TCS | SQL Interview Questions for TCS | Interview Questions Asked in TCS | TCS Interview Questions

A PRIMARY KEY Constraint automatically has a UNIQUE Constraint


de ned on it.

Note: You can have many UNIQUE Constraints per table, but only
one PRIMARY KEY Constraint per table is allowed.

5.What is the output of following Query?

 select case when null=null then ‘Amit’ Else


‘Pradnya’ from dual;

Answer:

In SQL null value is not equal to itself.So null=null is false and the
output of above query is ‘Pradnya’.

6.What are Set operators in SQL?

Answer:

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.

Following are Set Operators in SQL:

1. Union
2. Unionall
3. Intersect
4. Minus

Click Here to get more information about Set operators…

7.Explain Union Operator in detail?

Answer:

Union Operator combines the result of 2 or more tables and


fetches the results of two select statements.Union operator
eliminates the duplicates from the table and fetches the result.For
each duplicate row in table only one row is displayed in the
result.By considering the performance of SQL using union is not

http://www.complexsql.com/interview-questions-for-tcs/ 4/11
8/17/2018 Interview Questions for TCS | SQL Interview Questions for TCS | Interview Questions Asked in TCS | TCS Interview Questions

preferable option but if there is situation where user wants to


remove the duplicate data from two or more table the use of
Union is preferable.

8.How to select rst 5 characters from First name in Employee


table?

Answer:

Oracle Query:

 Select Substr(0,5) from Employee;

MS SQL:

 Select Substr(1,5) from Employee;

MySQL:

 Select Substr(1,5) from Employee;

9.How to fetch the name of the Employee by removing white


spaces?

Answer:

 Select trim(Employee_name) from


Employee;

10.How to fetch all the records from Employee whose joining year
is  2017?

Answer:

Oracle:

 select * from Employee where


To_char(Joining_date,’YYYY’)=’2017′;

MS SQL:

http://www.complexsql.com/interview-questions-for-tcs/ 5/11
8/17/2018 Interview Questions for TCS | SQL Interview Questions for TCS | Interview Questions Asked in TCS | TCS Interview Questions

 select * from Employee where


substr(convert(varchar,Joining_date,103),7,4)=’2017′;

CLICK HERE TO GET 20 Most important Complex SQL Queries..

11.What is mean by Sequence in database?(80 % asked


in Interview Questions for TCS)

Answer:

Use the CREATE SEQUENCE statement to create a sequence, which


is a database object from which multiple users may generate
unique integers. You can use sequences to automatically generate
primary key values.

When a sequence number is generated, the sequence is


incremented, independent of the transaction committing or rolling
back.

Once a sequence is created, you can access its values in SQL


statements with the CURRVAL Pseudo Column, which returns the
current value of the sequence, or the NEXTVAL Pseudo Column,
which increments the sequence and returns the new value.

12.What is rst and last function in SQL?

Answer:

The FIRST and LAST functions can be used to return the rst or last


value from an ordered sequence. Say we want to display the salary
of each Employee, along with the lowest and highest within their
department we may use something like.

Example:

 SELECT EmpNo, DeptNo, Sal ,MIN (Sal)


KEEP (DENSE_RANK FIRST ORDER BY
Sal) OVER (PARTITION BY
DeptNo)”Lowest”, MAX (Sal) KEEP

http://www.complexsql.com/interview-questions-for-tcs/ 6/11
8/17/2018 Interview Questions for TCS | SQL Interview Questions for TCS | Interview Questions Asked in TCS | TCS Interview Questions

(DENSE_RANK LAST ORDER BY Sal)


OVER (PARTITION BY DeptNo)
“Highest”FROM EMPLOYEE ORDER BY
DeptNo, Sal;

 13.What is join in SQL?(100% asked in Interview Questions for TCS)

Answer:

The most used concept in real life scenarios are nothing but SQL
Joins.Although in reporting,stand alone applications
development,Web application development the concept of join is
really important.

 Joins are nothing but Combining the


records from two or more tables.

There are following 2 types of joins:

1.Joins using Operators -> Equi Join,Non Equi Join

2.Joins using Concept-> Inner Join,Outer Join,Cross Join,Self Join.

CLICK HERE TO GET MORE INFORMATION ABOUT SQL JOINS

14.What is view in SQL?(100% asked in Interview Questions for


TCS)

Answer:

Views in SQL is nothing but the logical table created from one or
more tables.We can use the views to fetch the columns from one
or more di erent tables at a time.In real life speci cally views are
used in Reporting purpose.To create a report we need data from
di erent tables and need to show it on a single dashboard so we
are using the views to fetch the data from di erent tables.View can
contain all rows from the table or selected rows from the table.

CLICK HERE TO GET INFORMATION ABOUT SQL VIEWS in Detail

15.What is di erence between Union and Union all Operators?

Answer:

http://www.complexsql.com/interview-questions-for-tcs/ 7/11
8/17/2018 Interview Questions for TCS | SQL Interview Questions for TCS | Interview Questions Asked in TCS | TCS Interview Questions

Union Union ALL

1.Union Set operator is used 1.Union all Set operator is


to fetch the records from 2 used to fetch the records
di erent tables which from 2 di erent tables
eliminates the duplicate which does not eliminates
records the duplicate records

2.Syntax: 2.Syntax:

Select col1,col2…from Select col1,col2…from


table1; table1;

Union Union

Select col1,col2…from Select col1,col2…from


table2; table2;

3.For Performance tuning 3.Union all is preferable


Union operator is not operator in Performance
preferable as it takes time tuning.
to eliminate duplicate
records

16.Which is faster operator Union or union all?

Answer:

Union all is faster than union because it does not have sorting
program running inside.The union operator is slower than union
all because it removes duplicates from the data.To Remove
Duplicate compiler needs to run sorting program and table is
scanned full.

So Union all is faster than union operator.

17.What is di erence between Row_id and Rownum?

Answer:

ROWID is nothing but the physical address given to that row which
is in hexadecimal format.ROWNUM is nothing but the logical
sequence given to the row of that column.

18.How to Find table name and its owner?

http://www.complexsql.com/interview-questions-for-tcs/ 8/11
8/17/2018 Interview Questions for TCS | SQL Interview Questions for TCS | Interview Questions Asked in TCS | TCS Interview Questions

Answer:

To Find table name and its owner following query is used:

 Select table_name,Owner from All_tables


order by table_name,owner;

CLICK HERE TO GET MORE INFORMATION ABOUT ORACLE SYSTEM


TABLES

19.How to nd all details about Constraint?

Answer:

To nd details about constraint following query is used:

 1.Select * from User_constraints;


2.Select * from User_cons_columns;

20.How to Find the Sequence information?

Answer:

To Find the Sequence information following query is used:

 Select * from User_Sequences;

Click on Topic You want to learn:


1. History of SQL
2. SQL Create Table(DDL in SQL)
3. SQL DML Statements(INSERT,UPDATE,DELETE)
4. SQL Select Statement Execution
5. Operators in SQL
6. Views in SQL
7. Materialized View in SQL
8. Joins in SQL
9. Inner Join / Outer Join
10. Full Outer Join / Cartesian Join
11. Union and Union ALL
12. Intersect and Minus
13. Indexing in SQL

http://www.complexsql.com/interview-questions-for-tcs/ 9/11
8/17/2018 Interview Questions for TCS | SQL Interview Questions for TCS | Interview Questions Asked in TCS | TCS Interview Questions

14. Rank and Dense Rank


15. SubQueries and Correlated Subqueries
16. Parser and Optimizer
17. Oracle 11 G new Features
18. SQL Functions List
19. Constraints in SQL
20. Database Normalization
21. Table Partitioning

Hope you will like this article on Interview Questions for TCS.If you
want PDF document for this aritcle or if you like this article kindly
comment in comment box.

HOME

About The Author


Amit S
Oracle Consultant with Vast Experience in Oracle BI
and SQL PLSQL Development

Leave a Reply

http://www.complexsql.com/interview-questions-for-tcs/ 10/11
8/17/2018 Interview Questions for TCS | SQL Interview Questions for TCS | Interview Questions Asked in TCS | TCS Interview Questions

Comment Text*

Name*

Email*

Website

Save my name, email, and website in this browser for the next
time I comment.

Submit Comment

SQL WORLD Copyright © 2018. Theme by MyThemeShop

http://www.complexsql.com/interview-questions-for-tcs/ 11/11

You might also like