Upload
others
View
6
Download
0
Embed Size (px)
Citation preview
WWW.KAASHIVINFOTECH.COM - BEST IN-PLANT/ INTERNSHIP in Chennai
SQL Server Interview Questions Page 1
KAASHIV INFOTECH
The Asia, India,TamilNadu Book Of
Record Holders
SQL SERVER –
Booklet 11 - Gives you the interview tip SQL Server
WWW.KAASHIVINFOTECH.COM - BEST IN-PLANT/ INTERNSHIP in Chennai
SQL Server Interview Questions Page 2
KaaShiv InfoTech
Welcomes you to the Expert Voice Corner
Mr.J.Venkatesan Prabu
Venkatesan Prabu Jayakantham (venkat) has more than 8 years
experience in the Microsoft Technologies such as VB.Net, ASP.Net, C#.net,
SSIS, SSAS, ADO.Net, etc., He is the Managing Director of KAASHIVINFOTECH
(http://www.kaashivinfotech.com/),a software company in Chennai. Before
that, he worked in HCL Technologies (India and Australia) for six years as
Project Lead. As a service motive, Venkat contributed more than 700 articles
which is read by the developers in 170 countries (400 developers per day)
(http://venkattechnicalblog.blogspot.com/). Aligned with KaaShiv InfoTech’s
mission,he met more than 20,000 young minds and spreaded Microsoft
Technologies / Career guidance programs. Venkat won many awards in his
career, which includes Prestigious Microsoft MVP (Most Valuable Professional)
award for the years 2008,2009,2010,2011,2012,2013 and won many awards.
List of other awards in his career,
Microsoft certified Smart .Net Candidate in 2004
Most valuable member for dotnetspider site in 2007
WWW.KAASHIVINFOTECH.COM - BEST IN-PLANT/ INTERNSHIP in Chennai
SQL Server Interview Questions Page 3
HCL SQL Subject Matter expert (SME - SQL Server) for the year
(2008,2009)
HCL Special contribution award winner on Dotnet skills for year(2008)
HCL SQL Knowledge Champion for the year 2009
MindCracker MVP on SQLServer –2010 for the year 2010,2011
INETA champion - Gold Member – 2010 for the year 2010 HCL Service
Contribution Award for the year 2010
Leading Lights "Rising Star" award from Common Wealth Bank,
Australia for the year 2010
TECHNICAL CERTIFICATION
Cisco certified Network Associate (CCNA) – 2004
Microsoft Certified Application Developer (MCAD) – 2005
ACKNOWLEDGEMENT
I would like to thank my family members for their support and
encouragement. Without their support it would be impossible for me to
publish this e-book. I would also like to thank my KaaShiv InfoTech team for
their support to publish this e-book.
DISCLAIMER
All rights reserved. No part of this book may be copied, adapted,
abridged or stored in any retrieval system, computer system, photographic or
other system or transmitted in any form or by any means
without the prior written permission of the copyright holders.
Any breach will entail legal action and permission without
further notice.
WWW.KAASHIVINFOTECH.COM - BEST IN-PLANT/ INTERNSHIP in Chennai
SQL Server Interview Questions Page 4
1.Why we cannot use column alias in where clause but we can use it in order by clause
of select statement in sql server?
For example, it is incorrect to write:
SELECT Roll_No AS Id From Student WHERE Id > 1
While it correct:
SELECT Roll_No AS Id From Student ORDER BY Id
In sql server order of execution of different clauses of a select statement is following order:
Clause of select statement Execution order
FROM 1
ON 2
JOIN 3
WHERE 4
GROUP BY 5
WITH CUBE or WITH ROLLUP 6
HAVING 7
SELECT 8
DISTINCT 9
ORDER BY 10
TOP 11
It is clear the WHERE clause executes before the SELECT clause so WHERE clause has no
knowledge about column alias of SELECT clause while ORDER BY clause executes after
the SELECT clause so it know about column alias of SELECT clause.
INTERNSHIP IN KAASHIV INFOTECH
-Best internship provider in Chennai
Web Application Designing
Project Documentation
Live Inhouse Application
Development
Windows ADO.NET Application
Template Designing-Live Template
Designing, CSS
WWW.KAASHIVINFOTECH.COM - BEST IN-PLANT/ INTERNSHIP in Chennai
SQL Server Interview Questions Page 5
2.Which command using Query Analyzer will give you the version of SQL server and
operating system?
SELECT SERVERPROPERTY ('productversion'), SERVERPROPERTY ('productlevel'),
SERVERPROPERTY ('edition').
3. What is SQL Server Agent?
SQL Server agent plays an important role in the day-to-day tasks of a database administrator
(DBA). It is often overlooked as one of the main tools for SQL Server management. Its
purpose is to ease the implementation of tasks for the DBA, with its full- function scheduling
engine, which allows you to schedule your own jobs and scripts.
4. Can a stored procedure call itself or recursive stored procedure? How much level SP
nesting is possible?
Yes. Because Transact-SQL supports recursion, you can write stored procedures that
call themselves. Recursion can be defined as a method of problem solving wherein the
solution is arrived at by repetitively applying it to subsets of the problem. A common
application of recursive logic is to perform numeric computations that lend themselves to
repetitive evaluation by the same processing steps. Stored procedures are nested when one
stored procedure calls another or executes managed code by referencing a CLR routine, type,
or aggregate. You can nest stored procedures and managed code references up to 32 levels.
5. What is Log Shipping?
Log shipping is the process of automating the backup of database and transaction log
files on a production SQL server, and then restoring them onto a standby server. Enterprise
Editions only supports log shipping. In log shipping the transactional log file from one server
is automatically updated into the backup database on the other server. If one server fails, the
other server will have the same db and can be used this as the Disaster Recovery plan. The
key feature of log shipping is that it will automatically backup transaction logs throughout the
day and automatically restore them on the standby server at defined interval.
WWW.KAASHIVINFOTECH.COM - BEST IN-PLANT/ INTERNSHIP in Chennai
SQL Server Interview Questions Page 6
6. Name 3 ways to get an accurate count of the number of records in a table?
SELECT * FROM table1
SELECT COUNT(*) FROM table1 SELECT rows FROM sysindexes WHERE id = OBJECT_ID(table1) AND indid < 2
7. What does it mean to have QUOTED_IDENTIFIER ON? What are the implications
of having it OFF?
When SET QUOTED_IDENTIFIER is ON, identifiers can be delimited by double quotation
marks, and literals must be delimited by single quotation marks. When SET
QUOTED_IDENTIFIER is OFF, identifiers cannot be quoted and must follow all Transact-
SQL rules for identifiers.
8.What is NOT NULL Constraint?
A NOT NULL constraint enforces that the column will not accept null values. The not null
constraints are used to enforce domain integrity, as the check constraints.
9. How to get @@ERROR and @@ROWCOUNT at the same time?
If @@Rowcount is checked after Error checking statement then it will have 0 as the value of
@@Recordcount as it would have been reset. And if @@Recordcount is checked before the
error-checking statement then @@Error would get reset. To get @@error and @@rowcount
at the same time do both in same statement and store them in local variable.
SELECT @RC = @@ROWCOUNT, @ER = @@ERROR
10. What is a Scheduled Jobs or What is a Scheduled Tasks?
WWW.KAASHIVINFOTECH.COM - BEST IN-PLANT/ INTERNSHIP in Chennai
SQL Server Interview Questions Page 7
Scheduled tasks let user automate processes that run on regular or predictable cycles.
User can schedule administrative tasks, such as cube processing, to run during times of slow
business activity. User can also determine the order in which tasks run by creating job steps
within a SQL Server Agent job. E.g. back up database, Update Stats of Tables. Job steps give
user control over flow of execution. If one job fails, user can configure SQL Server Agent to
continue to run the remaining tasks or to stop execution.
11. What are the advantages of using Stored Procedures?
1. Stored procedure can reduced network traffic and latency, boosting application
performance.
2. Stored procedure execution plans can be reused, staying cached in SQL Server's
memory, reducing server overhead.
3. Stored procedures help promote code reuse.
4. Stored procedures can encapsulate logic. You can change stored procedure code
without affecting clients.
5. Stored procedures provide better security to your data.
12. What is a table called, if it has neither Cluster nor Non-cluster Index? What is it
used for?
Unindexed table or Heap. Microsoft Press Books and Book on Line (BOL) refers it as
Heap. A heap is a table that does not have a clustered index and, therefore, the pages are not
linked by pointers. The IAM pages are the only structures that link the pages in a table
together. Unindexed tables are good for fast storing of data. Many times it is better to drop all
indexes from table and then do bulk of inserts and to restore those indexes after that.
13. Can SQL Servers linked to other servers like Oracle?
SQL Server can be linked to any server provided it has OLE-DB provider from
Microsoft to allow a link. E.g. Oracle has an OLE-DB provider for oracle that Microsoft
provides to add it as linked server to SQL Server group.
14.How do you load large data to the SQL server database?
BulkCopy is a tool used to copy huge amount of data from tables. BULK INSERT
command helps to Imports a data file into a database table or view in a user-specified format.
15.What is Self Join?
This is a particular case when one table joins to itself, with one or two aliases to avoid
confusion. A self join can be of any type, as long as the joined tables are the same. A self join
is rather unique in that it involves a relationship with only one table. The common example is
when company has a hierarchal reporting structure whereby one member of staff reports to
another.
WWW.KAASHIVINFOTECH.COM - BEST IN-PLANT/ INTERNSHIP in Chennai
SQL Server Interview Questions Page 8
KaaShiv InfoTech Offers Best Inpant Training in Chennai.
The training at KAASHIV INFOTECH focus on developing the technical oriented concepts
that turn graduates into employable assets. Handled only by professionals from MNC companies, we
know how to equip you with strong technologies fundamentals.
INPLANT TRAINING SCHEDULE FOR CSE/IT/MCA STUDENTS
Day Programme
Day 1 BigData (Practical Demos)
Day 2 Windows 8 App Development (Practical Demos)
WWW.KAASHIVINFOTECH.COM - BEST IN-PLANT/ INTERNSHIP in Chennai
SQL Server Interview Questions Page 9
Day Programme
Day 3 Ethical Hacking (Facebook Hack,Server/Website Hacking(20 Attacks)
Day 4 Cloud Computing (Live Server Demo,Live Pjt Implementation)
Day 5 CCNA (-Networking-Router Configurations Practical Demo)
INPLANT TRAINING SCHEDULE FOR ELECTRONIC/ELECTRICAL/EIE STUDENTS
Day Programme
Day 1 Embedded System (Embedded Program Designing ,Chip Burning)
Day 2 Wireless System (Device Designing,Controlling Fans with Wireless
Sensors)
Day 3 CCNA (-Networking-Router Configurations Practical Demo)
Day 4 Ethical Hacking (Facebook Hack,Server/Website Hacking(20
Attacks)
Day 5 Matlab (Capture Image,Processing, Animate Images-Practical
Demos)
WWW.KAASHIVINFOTECH.COM - BEST IN-PLANT/ INTERNSHIP in Chennai
SQL Server Interview Questions Page 10
Day Programme
MECHANICAL/CIVIL INPLANT TRAINING SCHEDULE
Day Programme
Day 1 Aircraft Designing
Day 2 Vehicle Movement in Airports
Day 3 3D Packaging Designs
Day 4 3D Modeling
Day 5 3D Window Shading
Tags: inplanttraining in chennai,Best inplanttraining Program in Chennai Anna Nagar,Best and
Effective inplanttraining Program in Chennai at Anna Nagar ,inplanttraining Program for Engineering
Students , inplanttraining Program for Arts and Science Students , inplanttraining Program for BE
Students , inplanttraining Program for Information Technology Students ,inplanttraining Program in
Chennai , Best and Effective inplanttraining Program in Chennai,Best and good inplanttraining Program
in Chennai,inplanttraining Program for Computer Science Students, inplanttraining Program for
Electronics and Communication Students,inplanttraining Program for Electrical and Electronics Students
, inplanttraining Program for Engineering Studentsin anna nagar , inplanttraining Program for Arts and
Science Students in anna nagar,Effective inplanttraining Program,Effective and Free inplanttraining
Program,best inplanttraining in chennai near rountana,best inplanttraining for engineering students in
chennai,best inplanttraining in anna nagar,inplanttraining for arts and science students in tamil
nadu,best inplanttraining for arts and science students in anna nagar near rountana,best
inplanttraining for ug graduates,best inplanttraining for pg graduates,best inplanttraining for
b.e/b.tech students,best inplanttraining for ug graduates in chennai,best inplanttraining for ug
graduates in anna nagar,best inplanttraining for ug graduates in tamil nadu,best inplanttraining for
pg graduates in chennai,best inplanttraining for pg graduates in anna nagar,best inplanttraining for
pg graduates in tamil nadu,inplanttraining for cse students,inplanttraining for it
students,inplanttraining for ece students,inplanttraining for eee students,inplanttraining on android
in chennai,inplanttraining on java in chennai,inplanttraining on embedded systems in
chennai,inplanttraining on matlab in chennai,inplanttraining on .net in chennai,inplanttraining on
android in anna nagar,inplanttraining on java in anna nagar,inplanttraining on embedded systems in
anna nagar,inplanttraining on matlab in anna nagar,inplanttraining on .net in anna nagar,best summer
inplanttraining for arts and science ug graduates in chennai,best summer inplanttraining for arts and
science pg graduates in chennai,best summer inplanttraining for engineering ug graduates in
chennai,best summer inplanttraining for engineering pg graduates in chennai,best summer
inplanttraining for arts and science ug graduates in anna nagar,best summer inplanttraining for arts
and science pg graduates in anna nagar,best summer inplanttraining for engineering ug graduates in
WWW.KAASHIVINFOTECH.COM - BEST IN-PLANT/ INTERNSHIP in Chennai
SQL Server Interview Questions Page 11
anna nagar,best summer inplanttraining for engineering pg graduates in anna nagar,best inplanttraining
for mba graduates in chennai,best inplanttraining fo mca graduates in chennai,best inplanttraining for
mba graduates in anna nagar,best inplanttraining for mca graduates in anna nagar,best summer
inplanttraining for mba graduates in chennai,best summer inplanttraining for mca graduates in
chennai,best summer inplanttraining for mba graduates in anna nagar,best summer inplanttraining for
mcc graduates in anna nagar,best summer inplanttraining for mba graduates near rountana,best summer
inplanttraining for mca graduates near rountana
Address:
KAASHIV INFO TECH
Shivanantha Building,
X41, 5th Floor,2nd Avenue,
(Near Ayyappan Temple)
Anna Nagar, Chennai = 600040.
Send Us Your Request Email To [email protected],
Contact Number : 9840678906 ;; 9003718877 ;; 9962345637 ;
Visit our other websites:
http://www.inplanttrainingchennai.com
http://www.inplanttraining-in-chennai.com
http://www.Kaashiveinotech.com
http://www.internshipinchennai.in
https://plus.google.com/u/0/108546120202591604585
https://plus.google.com/u/0/b/110228862465265998202/dashboard/overview
https://plus.google.com/u/0/b/117408505876070870512/dashboard/overview
WWW.KAASHIVINFOTECH.COM - BEST IN-PLANT/ INTERNSHIP in Chennai
SQL Server Interview Questions Page 12
https://plus.google.com/u/0/b/104468163439231303834/dashboard/overview
https://plus.google.com/u/0/b/117640664472494971423/dashboard/overview
Feedback URLS
KaaShiv InfoTech Facebook Page
https://www.facebook.com/KaaShivInfoTech
Inplant Training Program in Chennai
https://www.facebook.com/pages/Inplant-Training-Program-in-
Chennai/1402097696706380
Internship in Chennai
https://www.facebook.com/pages/Internship-in-Chennai-
KaaShiv/1446147235603704
Inplant Training
https://www.facebook.com/pages/Inplant-Training/256116284550327
WWW.KAASHIVINFOTECH.COM - BEST IN-PLANT/ INTERNSHIP in Chennai
SQL Server Interview Questions Page 13