SQL SERVER INTERVIEW QUESTIONS 2014- SET 3 By
"Mr.J.Venkatesan Prabu"
KAASHIV INFOTECH
"Mr.J.Venkatesan Prabu"
1. What is UNIQUE KEY constraint?
A UNIQUE constraint enforces the uniqueness of the values
in a set of columns, so no duplicate values are entered. The unique key
constraints are used to enforce entity integrity as the primary key
constraints.
2. What is FOREIGN KEY?
A FOREIGN KEY constraint prevents any actions that would
destroy links between tables with the corresponding data values. A foreign key
in one table points to a primary key in another table. Foreign keys prevent
actions that would leave rows with foreign key values when there are no primary
keys with that value. The foreign key constraints are used to enforce
referential integrity.
3. What is CHECK Constraint?
A CHECK constraint is used to limit the values that can
be placed in a column. The check constraints are used to enforce domain
integrity.
4. When is the UPDATE_STATISTICS command
used?
- When the processing of large data is
done, this command is used.
- Whenever large number of deletions, modification or copy takes place into the
tables, the indexes need to be updated to take care of these changes.
UPDATE_STATISTICS performs this job.
5. Differentiate between a HAVING CLAUSE and a WHERE
CLAUSE.
HAVING CLAUSE
- HAVING CLAUSE is used only with the
SELECT statement.
- It is generally used in a GROUP BY clause in a query.
- If GROUP BY is not used, HAVING works like a WHERE clause.
WHERE Clause
- It is applied to each row before they
become a part of the GROUP BY function in a query.
6. What do you understand by a view? What does the WITH
CHECK OPTION clause for a view do?
- A view is a virtual table that
consists of fields from one or more real tables.
- It is usually used to join multiple tables and get the data.
- The WITH CHECK OPTION for a view prevents any modification to the data that
does not confirm to the WHERE clause of the view definition.
- This allows the data belonging to the view to be updated through the view.
7. Explain query execution plan?
- The optimizer available in SQL Server
optimizes the code to be effectively executed.
- A query execution plan shows how this optimizer would run the query.
- Query execution plan can be viewed by :
- Using the Show Execution Plan option available in Query Analyzer,
- Displaying Estimated Execution Plan on the query dropdown menu,
- Use the SET SHOWPLAN_TEXT ON command before running a query and capturing the
execution plan event in a SQL Server Profiler trace.
8. What is the function of SQL Server Agent Windows
service?
4. When is the UPDATE_STATISTICS command used?
- Whenever large number of deletions, modification or copy takes place into the tables, the indexes need to be updated to take care of these changes. UPDATE_STATISTICS performs this job.
- It is generally used in a GROUP BY clause in a query.
- If GROUP BY is not used, HAVING works like a WHERE clause.
- It is usually used to join multiple tables and get the data.
- The WITH CHECK OPTION for a view prevents any modification to the data that does not confirm to the WHERE clause of the view definition.
- This allows the data belonging to the view to be updated through the view.
- A query execution plan shows how this optimizer would run the query.
- Query execution plan can be viewed by :
- Using the Show Execution Plan option available in Query Analyzer,
- Displaying Estimated Execution Plan on the query dropdown menu,
- Use the SET SHOWPLAN_TEXT ON command before running a query and capturing the execution plan event in a SQL Server Profiler trace.
|
- This service is very useful in determining why a particular job did not run as intended.
- The transaction begins with some task and finishes only when all tasks within it are over.
- The transaction gets over successfully only when all commands in it are successfully over. Even if one command fails, the whole transaction fails.
- The BEGIN TRANSACTION, ROLLBACK TRANSACTION, and COMMIT TRANSACTION statements are used to work with transactions.
- A group of tasks starts with the begin statement.
- In case of any problem, the rollback command is executed to abort the transaction.
- If all the tasks run successfully, all commands are executed through commit statement.
- Primary key doesn't allow NULLs, but unique key allows one NULL.
- They help in promoting code reuse.
- They provide better security to data.
- It is possible to encapsulate the logic using stored procedures. This allows to change stored procedure code without affecting clients.
- It is possible to reuse stored procedure execution plans, which are cached in SQL Server's memory. This reduces server overhead.
a.) One-to-one
b.) One-to-many
c.) Many-to-many
b.) One-to-Many relationships - by splitting the data into two tables with primary key and foreign key relationships.
c.) Many-to-Many - by using a junction table with the keys from both the tables forming the composite primary key of the junction table.
- Truncate keeps the lock on table while Delete keeps the lock on each row.
- Truncate resets the counter of the Identity column while Delete doesn't do so.
- Trigger is not fired in Truncate while it happens in Delete.
1. Values are atomic.
2. Column values are of the same kind.
3. Each row is unique.
4. The sequence of columns is insignificant.
5. The sequence of rows is insignificant.
6. Each column must have a unique name.
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