Real Time Anz Sql Server Interview Questions and Answers PDF
• What Is A Foreign Key?
A foreign key is one table which can be related to the primary key of another table. Relationship needs to be created between two tables by referencing foreign key with the primary key of another table.
• What Is Normalization?
Normalization is the process of minimizing redundancy and dependency by organizing fields and table of a database. The main aim of Normalization is to add, delete or modify field that can be made in a single table.
• What Is Self-join?
Self-join is set to be query used to compare to itself. This is used to compare values in a column with other values in the same column in the same table. ALIAS ES can be used for the same table comparison.
• What Is Sql Profiler?
o Microsoft SQL Server Profiler is a graphical user interface to SQL Trace for monitoring an instance of the Database Engine or Analysis Services. You can capture and save data about each event to a file or table to analyze later.
o Use SQL Profiler to monitor only the events in which you are interested.
o If traces are becoming too large, you can filter them based on the information you want, so that only a subset of the event data is collected. Monitoring too many events adds overhead to the server and the monitoring process and can cause the trace file or trace table to grow very large, especially when the monitoring process takes place over a long period of time.
• How To Find Second Highest Salary Of An Employee?
There are many ways to find second highest salary of Employees in SQ. You can either use SQL Join or Subquery to solve this problem.
Here is SQL query using Subquery :
Select MAX(Salary) from table1 WHERE Salary NOT IN ( select MAX(Salary)
from table1.
• What Is The Difference Between Truncate And Drop Statements?
TRUNCATE removes all the rows from the table, and it cannot be rolled back. DROP command removes a table from the database and operation cannot be rolled back.
• What Are Aggregate And Scalar Functions?
Aggregate functions are used to evaluate mathematical calculation and return single values. This can be calculated from the columns in a table. Scalar functions return a single value based on the input value.
Example -.
Aggregate – max(), count – Calculated with respect to numeric.
Scalar – UCASE(), NOW() – Calculated with respect to strings.
• Which Operator Is Used In Query For Pattern Matching?
LIKE operator is used for pattern matching, and it can be used as -.
% – Matches zero or more characters.
_(Underscore) – Matching exactly one character.
No comments:
Post a Comment