SQL SERVER INTERVIEW QUESTIONS 2014- SET 4 By
"Mr.J.Venkatesan Prabu"
KAASHIV INFOTECH
"Mr.J.Venkatesan Prabu"
1. Explain the following.
a.) COLLATION.
Collation is a type of sort order. There are mainly three types of sort orders,
namely:
i.) Dictionary case sensitive
ii.)Dictionary - case insensitive
iii.)Binary.
b.) Stored Procedure
- It is a set of T-SQL statements combined together to perform a single task
formed by combining many small tasks.
- When you actually run a Stored procedure, a set of statements is run.
2. What do you mean by ACID?
- ACID (Atomicity Consistency Isolation
Durability) is a quality sought after in a reliable database. Here's the
relevance of each quality:
- Atomicity is an all-or-none proposition.
- Consistency - it guarantees that your database is never left by a transaction
in a half-finished state.
- Isolation - it keeps transactions separated from each other until they’re
finished.
- Durability - it ensures that the database keeps a track of pending changes in
a way that the server can recover from an abnormal termination.
3. Explain the following:
a.) Dirty pages.
These are the buffer pages that contain modifications which have not been
written to disk.
b.) ETL - Extraction, Transformation, and Loading.
- It is the process of copying and cleaning data from heterogeneous
sources.
- It is an important part of development projects for data warehousing and
business intelligence.
4. Differentiate between a Local and a Global temporary
table?
- A local temporary table exists only
for the duration of a connection or, if defined inside a compound statement,
for the duration of the compound statement.
- Global temporary tables (created with a double “##”) are visible to all
sessions.
- Global temporary tables are dropped when the session that created it ends,
and all other sessions have stopped referencing it.
5. Explain different types of Locks in SQL Server.
There are 3 kinds of locks in SQL
Server
i.) Shared locks - they are used for operations which do not allow any change
or update of data. For e.g. SELECT.
ii.) Update locks - they are used when SQL Server wants to modify a page. The
update page lock is then promoted to an exclusive page lock before actually
making the changes.
iii.) Exclusive locks - they are used for the data modification operations. For
e.g. UPDATE, INSERT, or DELETE
6.What is trigger?
Triggers allows us to execute a batch
of SQL code when either an insert, update or delete command is executed against
a specific table.
Triggers are special types of stored procedures that are defined to execute
automatically in place of or after data modifications. They can be executed
automatically on the insert, delete and update operation.
7.How many
types of triggers are there?
There are four
types of triggers.
1. Insert
2. Delete
3. Update
4. Instead of
8.What is constraints?
SQL Server users constraints to enforce
limitations on the data that can be entered
into a particular column in table. There are following types of
constraints.
Unique, Default, Check, Primary
Key, Foreign Key, Not Null.
9. How to
join two tables in Sql Server?
you can write
following sql statement
select category.*, categoryparent.categoryparent from category, categoryparent
where category.categoryparentid = categoryparent.autoid
I am assuming here that category.categoryparentid (foreign key) is the value of
categoryparent.autoid (primary key).
10.What's the
maximum size of a row?
8060 bytes. Don't be surprised with questions like 'what is the maximum number
of columns per table'. Check out SQL Server books online for the page titled:
"Maximum Capacity Specifications".
11.Difference
Between Implict Transaction And Explict Transaction
Implicit Transaction is the auto commit. There is no beginning or ending of the
transaction.
Explicit Transaction has the beginning, ending and rollback of transactions
with the command
Begin Transaction
Commit Transaction and
Rollback Transation
In the explicit transaction, if an error occurs in between we can rollback to
the beginning of the transaction which cannot be done in implicit transaction.
12.what is
the diff between a HAVING CLAUSE and a WHERE CLAUSE?
You can use Having Clause with the GROUP BY function in query and WHERE
Clause is applied to each row before they are part of the GROUP BY function in
a query.
13.How to
change Database name in SQL Server?
Use following
code
Supported in SQL Server 2000 and 2005
exec sp_renamedb "test", "test1"
Supported in SQL Server 2005 and later version
ALTER Database "test1" Modify Name="test"
Collation is a type of sort order. There are mainly three types of sort orders, namely:
i.) Dictionary case sensitive
ii.)Dictionary - case insensitive
iii.)Binary.
b.) Stored Procedure
- It is a set of T-SQL statements combined together to perform a single task formed by combining many small tasks.
- When you actually run a Stored procedure, a set of statements is run.
- Atomicity is an all-or-none proposition.
- Consistency - it guarantees that your database is never left by a transaction in a half-finished state.
- Isolation - it keeps transactions separated from each other until they’re finished.
- Durability - it ensures that the database keeps a track of pending changes in a way that the server can recover from an abnormal termination.
These are the buffer pages that contain modifications which have not been written to disk.
b.) ETL - Extraction, Transformation, and Loading.
- It is the process of copying and cleaning data from heterogeneous sources.
- It is an important part of development projects for data warehousing and business intelligence.
- Global temporary tables (created with a double “##”) are visible to all sessions.
- Global temporary tables are dropped when the session that created it ends, and all other sessions have stopped referencing it.
i.) Shared locks - they are used for operations which do not allow any change or update of data. For e.g. SELECT.
ii.) Update locks - they are used when SQL Server wants to modify a page. The update page lock is then promoted to an exclusive page lock before actually making the changes.
iii.) Exclusive locks - they are used for the data modification operations. For e.g. UPDATE, INSERT, or DELETE
Triggers are special types of stored procedures that are defined to execute automatically in place of or after data modifications. They can be executed automatically on the insert, delete and update operation.
1. Insert
2. Delete
3. Update
4. Instead of
Unique, Default, Check, Primary Key, Foreign Key, Not Null.
you can write following sql statement
select category.*, categoryparent.categoryparent from category, categoryparent where category.categoryparentid = categoryparent.autoid
I am assuming here that category.categoryparentid (foreign key) is the value of categoryparent.autoid (primary key).
8060 bytes. Don't be surprised with questions like 'what is the maximum number of columns per table'. Check out SQL Server books online for the page titled: "Maximum Capacity Specifications".
Implicit Transaction is the auto commit. There is no beginning or ending of the transaction.
Explicit Transaction has the beginning, ending and rollback of transactions with the command
Begin Transaction
Commit Transaction and
Rollback Transation
In the explicit transaction, if an error occurs in between we can rollback to the beginning of the transaction which cannot be done in implicit transaction.
Supported in SQL Server 2000 and 2005
exec sp_renamedb "test", "test1"
Supported in SQL Server 2005 and later version
ALTER Database "test1" Modify Name="test"
14.Write
SQL Query to display current date.
SQL has built in function called GetDate ()
which returns current timestamp.
15.When
do you use UPDATE_STATISTICS command?
This command is used when a large processing
of data has occurred. If any large amount of deletions, any modifications, or
Bulk Copy into the tables has occurred, it has to update the indexes to take
these changes into account. UPDATE_STATISTICS updates the indexes on these
tables accordingly.
16.How to create recursive query in SQL Server?
Recursive query can be create
in SQL using stored procedure but you can also use CTE (Common table
expression). It might be also worth asking about performance as CTE is not
always very fast.
Day
|
Programme
|
Day 1
|
BigData (Practical Demos)
|
Day 2
|
Windows 8 App Development (Practical Demos)
|
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)
|
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)
|
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
|
Shivanantha Building,
X41, 5th Floor,2nd Avenue,
(Near Ayyappan Temple)
Anna Nagar, Chennai = 600040.
No comments:
Post a Comment