Which is the true with View:
a Hide data complexity
b Organise data From Hetrogenious sources
c Reduce Object Size
d Usuful for Combine multiple logical table
e All are True
Ans:a
Which one is true with View:
a It is a permanet table
b It is a temporaray table
c It Is a logical table
d It is a physical table
Which Type of Parameter is not found in Stored Procedure?
a Input
b Output
c Ref
d All
Temporary stored Procedure Is found in :
a Master Database
b Model Database
c Msdb Database
d Temp Database
Which two are the fundamental object of ADO.Net?
a Dataset ,Dataadapter
b DataReader ,DataSet
c DataAdapter ,DataTable
d DataSet ,DataReader
select correct option-the .Net namespaces with the data functionality classes?
a System.Data
b System.Data.OleDB
c System.XML
d All
Which isolation level is used for COM+ object?
a READ COMMITTED
b READ UNCOMMITTED
c SERIALIZABLE
d None
What is full form of T-SQL?
a Transfer-SQL
b Transaction-SQL
c Transact-SQL
d None
What is the full form of KPI?
a Key Procedure Indicators
b Key Process Indicators
c Key Performance Indicators
What are the various lock types ?
a Shared
b update
c exclusive
d all
Ans:d
What is the use of CHAR function?
a Convert numeric to char type
b Convert char to numeric type
c convert char to char
d none
Can we create Web service in SQL Server 2005?
we can create web service in sql server 2005 by using an HTTP EndPoint
a No
b Yes
c May be yes
What is the result of "SELECT 2/2/4" in SQL ?
a 0.25
b 0.5
c 4
d 0
How we can check the database permission for any user?
a SELECT * FROM fn_my_permissions (null, 'DATA');
b SELECT * FROM fn_my_permissions (null, 'Table
c SELECT * FROM fn_my_permissions ('DATABASE');
d SELECT * FROM fn_my_permissions (null, 'DATABASE');
Can we restore the database forcefully when it is in use via SQL script?
a No
b Yes
c I dont know
How Many maximum parameter can be used with per stored procedure ?
a 1024
b 1096
c 2100
d Can not say
How many maximum columns can be used with per select
a Unlimited
b 32
c 4096
d 1024
e 64
Is this statement true or false:
A cursor is a pointer that identifies a specific working row within a set
a False
b True
c May be False
Which one of the following must be specified in every DELETE statement?
a set
b where
c Inner join
d Table Name
Which of the following is not a valid datatype in SQL Server?
a varchar
b datetime
c char
d vartext
What Will be Output
If we execute the following query then what will be output??
SELECT * FROM EMPLOYEE_MAST WHERE 1=2
a It will Display All the Records
b It will Display All the Columns
c It will Display Only Stucture
d It will Display 2nd Record
Which one is not true with stored Procedure?
a Pre Compiled Code
b Reduced Client Server Traffic
c Implenet reusebility
d Enhance Security
e Support SQL Injection
A trigger can be nested up to
a 12 Level
b 24 Level
c 32 Level
d 44 Level
What is the page size in SQL Server?
a 8954
b 4005
c 2000
d 8192
SELECT * FROM EMPLOYEE_MAST WHERE 1 =1
a It will display 1st record
b It will display 1st Column
c It will display All Records
d It Will display No Records
What happen when if SET NO-COUNT ON
a It will Show number of effected row. after query execution
b it Will Count number of effected row. after query execution
c it Will not Count number of effected row. after query execution
d It will not Show number of effected row. after query execution
Write a query to find the total number of rows in a table?
select count(*) from employee
What is the difference between IN and BETWEEN, that are used inside a WHERE clause?
The BETWEEN clause is used to fetch a range of values, whereas the IN clause fetches data from a list of specified values.
Write a query to eliminate duplicate records in the results of a table
select distinct * from employee
Write a query to insert a record into a table
insert into emp values ('ramu','22445')
Write a query to delete a record from a table
delete from emp where name='ramu.
Write a query to fetch the highest record in a table, based on a record, say salary field in the t_salary table
Select max(salary) from t_salary;
Diff b/w function and sp?
Primarily, the main difference between a Stored Procedure and a Function in SQL is that a Function has the ability to return a value to the calling routine, where as a Stored Procedure may or may not return a value, depending on how it is programmed. A Function should have a minimum of one return type.
Also, the results of a function may be assigned to a Select statement; this isn't possible with Stored Procs.
Write a query to concatenate two fields, say Designation and Department belonging to a table t_employee
Ans: Select Designation + ‘ ‘ + Department from t_employee;
What is the difference between UNION and UNION ALL in SQL?
Ans - UNION is an SQL keyword used to merge the results of two or more tables using a Select statement, containing the same fields, with removed duplicate values. UNION ALL does the same, however it persists duplicate values.
What is the difference between IN and BETWEEN, that are used inside a WHERE clause?
Ans - The BETWEEN clause is used to fetch a range of values, whereas the IN clause fetches data from a list of specified values.
What is the difference between where clause and having clause?
Ans:
The difference is that WHERE operates on individual rows, while HAVING operates on groups.
You can have WHERE without HAVING, you can have HAVING without WHERE, you can have both WHERE and HAVING, and you can have neither WHERE nor HAVING. But you can't have HAVING without grouping, even if the group consists of the entire result set.
diff b/w OrderBy and groupby
Ans:
Order by :just sorts a column data.
Group by : Groups it by similar data. Used for aggregation. Order by could be used inside the Grouped Items
In a table t_employee, the department column is nullable. Write a query to fetch employees which are not assigned a department yet.
Ans. Select empid, firstname, lastname from t_employee where department is null;
What are the large objects supported in MS SQL?
Ans: the data types are image and varbinary.
Whats the capacity of the image data type in MS SQL?
Ans - Variable-length binary data with a maximum length of 2^31 - 1 (2,147,483,647) bytes.
Whats the capacity of varbinary data type in MS SQL?
Ans - Variable-length binary data with a maximum length of 8,000 bytes.
What’s the difference between a primary key and a unique key?
Both Primary key and Unique key enforce the uniqueness of a column on which they are defined. However, a Primary key does not allow nulls, whereas unique key allow nulls.
Outer Join - In an Outer join, each record of a table does not really need to match with a record in the corresponding table. Outer joins maybe Left Outer Joins or Right Outher Joins. Outer Joins are always explicit.
Left Outer Join - This join contains all records from the left table, and matching records in the other table. However, if there are no matching records in the other table, it will still return a result, where in the records of the other table will be NULL.
Right Outer Join - This join fetches all records from the right table and only matching records from the left table. By saying left table, it means the table who's name is to the left of the Join Clause.
Full Outer Join - A full outer join merges the result fetched from Left and Right Outer joins
Cross Join - Also called Cartesian Join. It is the result of joining each row of a table with each row of the other table.
Inner Join - in this type of join, every record in the tables being joined have a matching record. The condition based on which the records are matched is called the join predicate.
What is a Self join?
Ans - A join created by joining two or more instances of a same table.
Query: Select A.firstname , B.firstname
from t_employee A, t_employee B
where A.supervisor_id = B.employee_id;
How to create a table in SQL? How to set a default value for a column?
create table emp(id int primary key,name varchar(20),city varchar(10) default '123')
what is DDL?
In SQL, DDL stands for Data Definition Language. It is the part of SQL programming language that deals with the construction and alteration of database structures like tables, views, and further the entities inside these tables like columns. It may be used to set the properties of columns as well.
The three popular commands used in DDL are:
Create - Used to create tables, views, and also used to create functions, stored procedures, triggers, indexes etc.
Drop - Used to totally eliminate a table, view, index from a database - which means that the records as well as the total structure is eliminated from the database.
DROP TABLE t_students;
Alter - Used to alter or in other words, change the structure of a table, view, index. This is particularly used when there is a scenario wherein the properties of fields inside a table, view, index are supposed to be updated.
DML - stands for Data Manipulation Language, its the part of SQL that deals with querying, updating, deleting and inseting records in tables, views.
insert,delete,select,update
what is Schema?
The relationships between different tables in a database are often referred to as Database Schema.
What are ACID Rules of transaction in a database? Atomicity, Consistency, Isolation, Durability
The ACID rules of transaction in any database assure the reliability of data in all transactions in the database.
Atomicity - this rule states that either the complete transaction takes place, or none. Even if a part of a transaction fails to work, the complete transaction will fail.
Consistency - this rule ensures that the database is stable, before and after the transaction, even if a transaction fails.
Isolation - this rule states that when a process is going on in a transaction, the data remains in isolation of other entities in the database.
Durability - this rule states that when a transaction completes successfully, it remains in stable state and is persisted in the database.
What is a NULL entity in SQL?
Null is an entity in SQL that is used to specify that a value does not exist. It is a reserved keyword in SQL.
Most SQL languages use the expression IS NULL in the where clause for matching records with NULL values, instead of comparing with NULL using an equality operator. See code example below:
SELECT FIRSTNAME FROM T_STUDENTS WHERE LASTNAME IS NULL;
Following functions handle Null values:
Coalesce - This function returns the first non NULL value from a list of values.
NullIf - This function accepts 2 paramaters. If both parameters are equal, NULL is returned, else the first paramater's value is returned.
What is the difference between a Table, View and Synonym in SQL?
A Table is a repository of data, where in the table itself is a physical entity. The table resides physically in the database.
A View is not a part of the database's physical representation. It is precompiled, so that data retrieval behaves faster, and also provide a secure accessibility mechanism.
The advantages of using a view are as follows:
- It may access data from a table, multiple tables, view, multiple views, or a combination of these
- A view connects to the data of its base table(s).
- Provides a secure mechanism of data accessibility
Synonym is alternate name assigned to a table, view, sequence or program unit.
- It may be used to shadow the original name and owner of the actual entity
- Extends the reach of tables, by allowing public access to the synonym
SQL KEYWORDS
ORDER BY
- used to sort the result-set by a specified column.
- sort the records in ascending order by default.
- If you want to sort the records in a descending order, you can use the DESC keyword.
Syntax
SELECT column_name(s) FROM table_name ORDER BY column_name(s) ASC|DESC
TOP
· The TOP clause is used to specify the number of records to return.
Syntax
SELECT TOP number|percent column_name(s) FROM table_name
SELECT TOP 2 * FROM Persons
SELECT TOP 50 PERCENT * FROM Persons
LIKE
· The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.
Syntax
SELECT column_name(s) FROM table_name WHERE column_name LIKE pattern
SELECT * FROM Persons WHERE City LIKE 's%'
SQL Wildcards
· SQL wildcards can substitute for one or more characters when searching for data in a database.
· SQL wildcards must be used with the SQL LIKE operator.
With SQL, the following wildcards can be used:
The IN Operator
- The IN operator allows you to specify multiple values in a WHERE clause.
Syntax
SELECT column_name(s) FROM table_name WHERE column_name IN (value1,value2,...)
The BETWEEN Operator
- selects a range of data between two values. The values can be numbers, text, or dates.
Syntax
SELECT column_name(s) FROM table_name WHERE column_name BETWEEN value1 AND value2
SQL Alias
- You can give a table or a column another name by using an alias. This can be a good thing to do if you have very long or complex table names or column names.
- An alias name could be anything, but usually it is short.
SQL Alias Syntax for Table
SELECT column_name(s) FROM table_name AS alias_name
SQL Alias Syntax for Columns
SELECT column_name AS alias_name FROM table_name
SQL Constraints
- Constraints are used to limit the type of data that can go into a table.
- Constraints can be specified when a table is created (with the CREATE TABLE statement) or after the table is created (with the ALTER TABLE statement).
constraints:
NOT NULL
UNIQUE
PRIMARY KEY
FOREIGN KEY
CHECK
DEFAULT
NOT NULL
The NOT NULL constraint enforces a column to NOT accept NULL values.
The following SQL enforces the "P_Id" column and the "LastName" column to not accept NULL values:
UNIQUE
The UNIQUE constraint uniquely identifies each record in a database table.
PRIMARY KEY
- The PRIMARY KEY constraint uniquely identifies each record in a database table.
- Primary keys must contain unique values.
- A primary key column cannot contain NULL values.
- Each table should have a primary key, and each table can have only ONE primary key.
CREATE TABLE Persons
(
P_Id int NOT NULL PRIMARY KEY,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
FOREIGN KEY
- A FOREIGN KEY in one table points to a PRIMARY KEY in another table.
- The FOREIGN KEY constraint is used to prevent actions that would destroy links between tables.
- The FOREIGN KEY constraint also prevents that invalid data form being inserted into the foreign key column, because it has to be one of the values contained in the table it points to.
Check
- The CHECK constraint is used to limit the value range that can be placed in a column.
- If you define a CHECK constraint on a single column it allows only certain values for this column.
DEFAULT
- The DEFAULT constraint is used to insert a default value into a column.
- The default value will be added to all new records, if no other value is specified.
Index
- The CREATE INDEX statement is used to create indexes in tables.
- Indexes allow the database application to find data fast; without reading the whole table.
- An index can be created in a table to find data more quickly and efficiently.
- The users cannot see the indexes, they are just used to speed up searches/queries.
- Updating a table with indexes takes more time than updating a table without (because the indexes also need an update). So you should only create indexes on columns (and tables) that will be frequently searched against.
Syntax
Creates an index on a table. Duplicate values are allowed:
CREATE INDEX index_name
ON table_name (column_name)
SQL CREATE UNIQUE INDEX Syntax
Creates a unique index on a table. Duplicate values are not allowed:CREATE UNIQUE INDEX index_name
ON table_name (column_name)
DROP
Indexes, tables, and databases can easily be deleted/removed with the DROP statement.
ALTER
- The ALTER TABLE statement is used to add, delete, or modify columns in an existing table.
To add a column in a table
ALTER TABLE table_name
ADD column_name datatype
To delete a column in a table
ALTER TABLE table_name
DROP COLUMN column_name
To change the data type of a column in a table
ALTER TABLE table_name
ALTER COLUMN column_name datatype
AUTO-INCREMENT
- allows a unique number to be generated when a new record is inserted into a table.
- the primary key field to be created automatically every time a new record is inserted.
- The MS SQL Server uses the IDENTITY keyword to perform an auto-increment feature.
- By default, the starting value for IDENTITY is 1, and it will increment by 1 for each new record
VIEW
· An Index is a data structure that is created to improve the performance of the data fetch operations on a table
· A view is similar to a table but may contain data from one or more tables connected to one another through a business logic. A view can be created to implement business logic or to conceal the underlying table implementation from everyone
· view is a virtual table based on the result-set of an SQL statement.
Date functions
GETDATE()
returns the current date and time from the SQL Server.
Example:
SELECT GETDATE() AS CurrentDateTime
DATEPART()
to return a single part of a date/time, such as year, month, day, hour, minute, etc.
Syntax
DATEPART(datepart,date)
Where date is a valid date expression and datepart can be one of the following:
DATEADD()
adds or subtracts a specified time interval from a date.
Syntax:
DATEADD(datepart,number,date)
Where date is a valid date expression and number is the number of interval you want to add. The number can either be positive, for dates in the future, or negative, for dates in the past.
DATEDIFF()
returns the time between two dates.
CONVERT
The CONVERT() function can be used to display date/time data in different formats.
Syntax:
CONVERT(data_type(length),data_to_be_converted,style)
Where data_type(length) specifies the target data type (with an optional length), data_to_be_converted contains the value to be converted, and style specifies the output format for the date/time.
What is heap table in SQL SERVER ?
A table that doesnot contains cluster and non cluster index is heap table because there is no indexing there on to the table.
What is SQL Cache Dependency in ASP.NET 2.0?
Answer: SQL cache dependencies is new technique in ASP.NET 2.0 which can automatically invalidate a cached data object just like a Dataset. when the related data is modified in the database. So for instance if you have a dataset which is tied up to a database tables any changes in the database table will invalidate the cached data object which can be a dataset or a data source.To enable this we need a syntax that is as follows:- aspnet_regsql -ed -E -d Northwind
How many kind of User-Defined Functions can be created in Sql Server-2000 ?
Answer: There are three types of User-Defined functions in SQL Server 2000 and they are Scalar, Inline Table-Valued and Multi-statement Table-valued.A Scalar user-defined function returns one of the scalar data types.An Inline Table-Value user-defined function returns a table data type.A Multi-Statement Table-Value user-defined function returns a table.
How many types of local tables in SQL SERVER ?
Answer: There are 2 types of temporary tables, local and global. Local temporary tables are created using a single pound (#) sign and are visible to a single connection and automatically dropped when that connection ends. Global temporary tables are created using a double pound (##) sign and are visible across multiple connections and users and are automatically dropped when all SQL sessions stop referencing the global temporary table.
How to load .NET code in SQL SERVER 2005 ?
Answer: First of all write managed code and compile it to DLL/Assembly.Now we can load the assembly in SQL SERVER.Here i have given a example of SQL SERVER. CREATE ASSEMBLY percode FROM 'c:/percode.dll'
Where .NET CLR and SQL SERVER run ?
Answer: All .net realtes application and Sql Server runs in same process or we can say that on same address because there is no issue of speed because if these two process are run in different process then there may be a speed issue created one process goes fast and other slow may create the problem.
What are Checkpoint in SQL Server ?
Answer: When we done operation on SQL SERVER that is not commited directly to the database.All operation must be logged in to Transaction Log files after that they should be done on to the main database.CheckPoint are the point which alert Sql Server to save all the data to main database if no check point is there then log files get full we can use Checkpoint command to commit all data in the SQL SERVER.When we stop the SQL Server it will take long time because Checkpoint is also fired.
Can You explain integration between SQL Server 2005 and Visual Studio 2005 ?
Answer: This intergration provide wider range of development with the help of CLR for database server.Becasue CLR helps developers to get flexibility for developing database applications and also provides language interoperability just like Visual C++, Visual Basic .Net and Visual C# .Net. The CLR helps developers to get the arrays, classes and exception handling available through programming languages such as Visual C++ or Visual C# which is use in stored procedures, functions and triggers for creating database application dynamically and also provide more efficient reuse of code and faster execution of complex tasks. We particularly liked the error-checking powers of the CLR environment, which reduces run-time errors
What is the diffrence between SQL and Pl/Sql ?
Answer: We can get modify, Retrieve by single command or statement in SQL but PL/SQL process all SQL statements one at a time. With PL/SQL, an entire block of statements process in a single command line.sql is structured query language ,various queries are used to handle the database in a simplified manner. while pl/sql is procedural language contains various types of variable,functions and procedures and other major diffrence is Sql as the name suggest it is just structured query language wheareas PLSQL is a commbination of Programming language & SQL.
What is DTS in SQL Server ?
Answer: If a organization is big then it is also there that there is multiple option to store data some people are using EXCEL some are using ACCESS and some of they are using SQL SERVER and in some other format also but there a problem is arise that how to merge that data into one format there is diffrent tool are there for doing this funtion. One of product of SQL SERVER-2000 DTS helps in this problem it provides a set of tool from that tool we can customise are database acording to our need DTSRun is a command-prompt utility used to execute existing DTS packages.
What is the difference betweenUNION ALL Statement and UNION ?
Answer:- The main difference between UNION ALL statement and UNION is UNION All statement is much faster than UNION,the reason behind this is that because UNION ALL statement does not look for duplicate rows, but on the other hand UNION statement does look for duplicate rows, whether or not they exist.
Write some disadvantage of Cursor ?
Answer:- Cursor plays there row quite nicely but although there are some disadvantage of Cursor .
Because we know cursor doing roundtrip it will make network line busy and also make time consuming methods. First of all select query gernate output and after that cursor goes one by one so roundtrip happen.Another disadvange of cursor are ther are too costly because they require lot of resources and temporary storage so network is quite busy.
What is Log Shipping and its purpose ?
Answer: In Log Shipping the transactional log file from one server is automatically updated in backup database on the other server and in the case when one server fails the other server will have the same DB and we can use this as the DDR(disaster recovery) plan.
What are the null values in SQL SERVER ?
Answer: Before understand the null values we have some overview about what the value is. Value is the actual data stored in a particular field of particular record. But what is done when there is no values in the field.That value is something like.Nulls present missing information. We can also called null propagation.
What is difference between OSQL and Query Analyzer ?
Answer: Both are same for functioning but there is a little difference OSQL is command line tool which execute query and display the result same a Query Analyzer do but Query Analyzer is graphical.OSQL have not ability like Query Analyzer to analyze queries and show statistics on speed of execution .And other useful thing about OSQL is that its helps in scheduling which is done in Query Analyzer with the help of JOB.
A table that doesnot contains cluster and non cluster index is heap table because there is no indexing there on to the table.
What is SQL Cache Dependency in ASP.NET 2.0?
Answer: SQL cache dependencies is new technique in ASP.NET 2.0 which can automatically invalidate a cached data object just like a Dataset. when the related data is modified in the database. So for instance if you have a dataset which is tied up to a database tables any changes in the database table will invalidate the cached data object which can be a dataset or a data source.To enable this we need a syntax that is as follows:- aspnet_regsql -ed -E -d Northwind
How many kind of User-Defined Functions can be created in Sql Server-2000 ?
Answer: There are three types of User-Defined functions in SQL Server 2000 and they are Scalar, Inline Table-Valued and Multi-statement Table-valued.A Scalar user-defined function returns one of the scalar data types.An Inline Table-Value user-defined function returns a table data type.A Multi-Statement Table-Value user-defined function returns a table.
How many types of local tables in SQL SERVER ?
Answer: There are 2 types of temporary tables, local and global. Local temporary tables are created using a single pound (#) sign and are visible to a single connection and automatically dropped when that connection ends. Global temporary tables are created using a double pound (##) sign and are visible across multiple connections and users and are automatically dropped when all SQL sessions stop referencing the global temporary table.
How to load .NET code in SQL SERVER 2005 ?
Answer: First of all write managed code and compile it to DLL/Assembly.Now we can load the assembly in SQL SERVER.Here i have given a example of SQL SERVER. CREATE ASSEMBLY percode FROM 'c:/percode.dll'
Where .NET CLR and SQL SERVER run ?
Answer: All .net realtes application and Sql Server runs in same process or we can say that on same address because there is no issue of speed because if these two process are run in different process then there may be a speed issue created one process goes fast and other slow may create the problem.
What are Checkpoint in SQL Server ?
Answer: When we done operation on SQL SERVER that is not commited directly to the database.All operation must be logged in to Transaction Log files after that they should be done on to the main database.CheckPoint are the point which alert Sql Server to save all the data to main database if no check point is there then log files get full we can use Checkpoint command to commit all data in the SQL SERVER.When we stop the SQL Server it will take long time because Checkpoint is also fired.
Can You explain integration between SQL Server 2005 and Visual Studio 2005 ?
Answer: This intergration provide wider range of development with the help of CLR for database server.Becasue CLR helps developers to get flexibility for developing database applications and also provides language interoperability just like Visual C++, Visual Basic .Net and Visual C# .Net. The CLR helps developers to get the arrays, classes and exception handling available through programming languages such as Visual C++ or Visual C# which is use in stored procedures, functions and triggers for creating database application dynamically and also provide more efficient reuse of code and faster execution of complex tasks. We particularly liked the error-checking powers of the CLR environment, which reduces run-time errors
What is the diffrence between SQL and Pl/Sql ?
Answer: We can get modify, Retrieve by single command or statement in SQL but PL/SQL process all SQL statements one at a time. With PL/SQL, an entire block of statements process in a single command line.sql is structured query language ,various queries are used to handle the database in a simplified manner. while pl/sql is procedural language contains various types of variable,functions and procedures and other major diffrence is Sql as the name suggest it is just structured query language wheareas PLSQL is a commbination of Programming language & SQL.
What is DTS in SQL Server ?
Answer: If a organization is big then it is also there that there is multiple option to store data some people are using EXCEL some are using ACCESS and some of they are using SQL SERVER and in some other format also but there a problem is arise that how to merge that data into one format there is diffrent tool are there for doing this funtion. One of product of SQL SERVER-2000 DTS helps in this problem it provides a set of tool from that tool we can customise are database acording to our need DTSRun is a command-prompt utility used to execute existing DTS packages.
What is the difference between
Answer:- The main difference between UNION ALL statement and UNION is UNION All statement is much faster than UNION,the reason behind this is that because UNION ALL statement does not look for duplicate rows, but on the other hand UNION statement does look for duplicate rows, whether or not they exist.
Write some disadvantage of Cursor ?
Answer:- Cursor plays there row quite nicely but although there are some disadvantage of Cursor .
Because we know cursor doing roundtrip it will make network line busy and also make time consuming methods. First of all select query gernate output and after that cursor goes one by one so roundtrip happen.Another disadvange of cursor are ther are too costly because they require lot of resources and temporary storage so network is quite busy.
What is Log Shipping and its purpose ?
Answer: In Log Shipping the transactional log file from one server is automatically updated in backup database on the other server and in the case when one server fails the other server will have the same DB and we can use this as the DDR(disaster recovery) plan.
What are the null values in SQL SERVER ?
Answer: Before understand the null values we have some overview about what the value is. Value is the actual data stored in a particular field of particular record. But what is done when there is no values in the field.That value is something like
What is difference between OSQL and Query Analyzer ?
Answer: Both are same for functioning but there is a little difference OSQL is command line tool which execute query and display the result same a Query Analyzer do but Query Analyzer is graphical.OSQL have not ability like Query Analyzer to analyze queries and show statistics on speed of execution .And other useful thing about OSQL is that its helps in scheduling which is done in Query Analyzer with the help of JOB.
SQL SERVER Query
Write a Role of Sql Server 2005 in XML Web Services?
Answer:- SQL Server 2005 create a standard method for getting the database engine using SOAP via HTTP. By this method, we can send SOAP/HTTP requests to SQL Server for executing T-SQL batch statements, stored procedures, extended stored procedures, and scalar-valued user-defined functions may be with or without parameters.
What are the different types of Locks ?
Answer: There are three main types of locks that SQL Server
(1)Shared locks are used for operations that does not allow to change or update data, such as a SELECT statement.
(2)Update locks are used when SQL Server intends to modify a page, and later promotes the update page lock to an exclusive page lock before actually making the changes.
(3)Exclusive locks are used for the data modification operations, such as UPDATE, INSERT, or DELETE.
Explain some SQL Server 2000 Query?
Answer: Here are some sql server 2000 query like Sql Insert Query, Delete Sql Query, Update Sql Query and Sql Create Query:
1) Sql Insert Query:
a) How to encrypt data by using Sql Insert Query.
--: insert into table_name(Tablecolumn1, tablecolumn2,. . . . .) values ('value1', pwdencrypt('value'),. . . .)
b) How to copy data from one table to another with the help of Sql Insert Query.
--: insert into table_name(column1,column2,. . . . ) select column1, column2, . . . . from table_name2
c) Sql Insert Query using where clause
--: insert into tablename(column1,column2) select column1,column2 from tablename2 where id=value.
What is 'Write-ahead log' in Sql Server 2000 ?
Answer: Before understanding it we must have an idea about the transaction log files. These files are the files which holds the data for change in database .
Now we explain when we are doing some Sql Server 2000 query or any Sql query like Sql insert query,delete sql query,update sql query and change the data in sql server database it cannot change the database directly to table .Sql server extracts the data that is modified by sql server 2000 query or by sql query and places it in memory.Once data is stores in memory user can make changes to that a log file is gernated this log file is gernated in every five mintues of transaction is done. After this sql server writes changes to database with the help of transaction log files. This is called Write-ahead log.
What do u mean by Extents and types of Extends ?Answer:- SQL Server 2005 create a standard method for getting the database engine using SOAP via HTTP. By this method, we can send SOAP/HTTP requests to SQL Server for executing T-SQL batch statements, stored procedures, extended stored procedures, and scalar-valued user-defined functions may be with or without parameters.
What are the different types of Locks ?
Answer: There are three main types of locks that SQL Server
(1)Shared locks are used for operations that does not allow to change or update data, such as a SELECT statement.
(2)Update locks are used when SQL Server intends to modify a page, and later promotes the update page lock to an exclusive page lock before actually making the changes.
(3)Exclusive locks are used for the data modification operations, such as UPDATE, INSERT, or DELETE.
Explain some SQL Server 2000 Query?
Answer: Here are some sql server 2000 query like Sql Insert Query, Delete Sql Query, Update Sql Query and Sql Create Query:
1) Sql Insert Query:
a) How to encrypt data by using Sql Insert Query.
--: insert into table_name(Tablecolumn1, tablecolumn2,. . . . .) values ('value1', pwdencrypt('value'),. . . .)
b) How to copy data from one table to another with the help of Sql Insert Query.
--: insert into table_name(column1,column2,. . . . ) select column1, column2, . . . . from table_name2
c) Sql Insert Query using where clause
--: insert into tablename(column1,column2) select column1,column2 from tablename2 where id=value.
What is 'Write-ahead log' in Sql Server 2000 ?
Answer: Before understanding it we must have an idea about the transaction log files. These files are the files which holds the data for change in database .
Now we explain when we are doing some Sql Server 2000 query or any Sql query like Sql insert query,delete sql query,update sql query and change the data in sql server database it cannot change the database directly to table .Sql server extracts the data that is modified by sql server 2000 query or by sql query and places it in memory.Once data is stores in memory user can make changes to that a log file is gernated this log file is gernated in every five mintues of transaction is done. After this sql server writes changes to database with the help of transaction log files. This is called Write-ahead log.
Answer: An Extent is a collection of 8 sequential pages to hold database from becoming fregmented. Fragment means these pages relates to same table of database these also holds in indexing. To avoid for fragmentation Sql Server assign space to table in extents. So that the Sql Server keep upto date data in extents. Because these pages are continously one after another. There are usually two types of extends:-Uniform and Mixed.
Uniform means when extent is own by a single object means all collection of 8 ages hold by a single extend is called uniform.
Mixed mean when more then one object is comes in extents is known as mixed extents.
What is different in Rules and Constraints ?
Answer: Rules and Constraints are similar in functionality but there is a An little diffrence between them.Rules are used for backward compatibility . One the most exclusive diffrence is that we an bind rules to a datatypes whereas constraints are bound only to columns.So we can create our own datatype with the help of Rules and get the input according to that.
What is defaults in Sql Server and types of Defaults ?
Answer: Defaults are used when a field of columns is allmost common for all the rows for example in employee table all living in delhi that value of this field is common for all the row in the table if we set this field as default the value that is not fill by us automatically fills the value in the field its also work as intellisense means when user inputing d it will automatically fill the delhi . There are two types of defaults object and definations.
Object deault:-These defaults are applicable on a particular columns . These are usually deined at the time of table designing.When u set the object default field in column state this column in automatically field when u left this filed blank.
Defination default:-When we bind the datatype with default let we named this as dotnet .Then every time we create column and named its datatype as dotnet it will behave the same that we set for dotnet datatype.
What Is Database ?
Answer: A database is similar to a data file in that it is a storage place for data. Like a data file, a database does not present information directly to a user; the user runs an application that accesses data from the database and presents it to the user in an understandable format.Database systems are more powerful than data files in that data is more highly organized. In a well-designed database, there are no duplicate pieces of data that the user or application must update at the same time. Related pieces of data are grouped together in a single structure or record, and relationships can be defined between these structures and records.When working with data files, an application must be coded to work with the specific structure of each data file. In contrast, a database contains a catalog that applications use to determine how data is organized. Generic database applications can use the catalog to present users with data from different databases dynamically, without being tied to a specific data format. A database typically has two main parts: first, the files holding the physical database and second, the database management system (DBMS) software that applications use to access data. The DBMS is responsible for enforcing the database structure, including: · Maintaining relationships between data in the database. Ensuring that data is stored correctly, and that the rules defining data relationships are not violated. · Recovering all data to a point of known consistency in case of system failures.
what is Relational Database ?
Answer: Although there are different ways to organize data in a database, relational databases are one of the most effective. Relational database systems are an application of mathematical set theory to the problem of effectively organizing data. In a relational database, data is collected into tables (called relations in relational theory). A table represents some class of objects that are important to an organization. For example, a company may have a database with a table for employees, another table for customers, and another for stores. Each table is built of columns and rows (called attributes and tuples in relational theory). Each column represents some attribute of the object represented by the table. For example, an Employee table would typically have columns for attributes such as first name, last name, employee ID, department, pay grade, and job title. Each row represents an instance of the object represented by the table. For example, one row in the Employee table represents the employee who has employee ID 12345. When organizing data into tables, you can usually find many different ways to define tables. Relational database theory defines a process called normalization, which ensures that the set of tables you define will organize your data effectively.
What is COMMIT & ROLLBACK statement in SQL ?
Answer: Commit statement helps in termination of the current transaction and do all the changes that occur in transaction persistent and this also commits all the changes to the database.COMMIT we can also use in store procedure.
ROLLBACK do the same thing just terminate the currenct transaction but one another thing is that the changes made to database are ROLLBACK to the database.
What is diffrence between OSQL and Query Analyzer ?
Answer:-Both are the same but ther eis little diffrence OSQL is command line tool whic is execute qery and display the result same a query analyzer but query analyzer is graphical and OSQL is a command line tool.OSQL have not ability like query analyzer to analyze queries and show statics on speed of execution and other usefull thing about OSQL is that its helps in scheduling.
What is Data Integrity and it's categories ?
Answer: Enforcing data integrity ensures the quality of the data in the database. For example, if an employee is entered with an employee_id value of 123, the database should not allow another employee to have an ID with the same value. If you have an employee_rating column intended to have values ranging from 1 to 5, the database should not accept a value of 6. If the table has a dept_id column that stores the department number for the employee, the database should allow only values that are valid for the department numbers in the company. Two important steps in planning tables are to identify valid values for a column and to decide how to enforce the integrity of the data in the column. Data integrity falls into these categories:
1) Entity integrity
2) Domain integrity
3) Referential integrity
4) User-defined integrity
Entity Integrity: Entity integrity defines a row as a unique entity for a particular table. Entity integrity enforces the integrity of the identifier column(s) or the primary key of a table (through indexes, UNIQUE constraints, PRIMARY KEY constraints, or IDENTITY properties).
Domain Integrity: Domain integrity is the validity of entries for a given column. You can enforce domain integrity by restricting the type (through data types), the format (through CHECK constraints and rules), or the range of possible values (through FOREIGN KEY constraints, CHECK constraints, DEFAULT efinitions, NOT NULL definitions, and rules).
Referential Integrity: Referential integrity preserves the defined relationships between tables when records are entered or deleted. In Microsoft® SQL Server™ 2000, referential integrity is based on relationships between foreign keys and primary keys or between foreign keys and unique keys (through FOREIGN KEY and CHECK constraints). Referential integrity ensures that key values are consistent across tables. Such consistency requires that there be no references to nonexistent values and that if a key value changes, all references to it change consistently throughout the database. When you enforce referential integrity, SQL Server prevents users from:
· Adding records to a related table if there is no associated record in the primary table.
· Changing values in a primary table that result in orphaned records in a related table.
· Deleting records from a primary table if there are matching related records.
For example, with the sales and titles tables in the pubs database, referential integrity is based on the relationship between the foreign key (title_id) in the sales table and the primary key (title_id) in the titles table.
User-Defined: Integrity User-defined integrity allows you to define specific business rules that do not fall into one of the other integrity categories. All of the integrity categories support user-defined integrity (all column- and table-level constraints in CREATE TABLE, stored procedures, and triggers).
What is the use of DBCC commands?
Answer: DBCC stands for database consistency checker. We use these commands to check the consistency of the databases, i.e., maintenance, validation task and status checks.DBCC CHECKDB - Ensures that tables in the db and the indexes are correctly linked.and DBCC CHECKALLOC To check that all pages in a db are correctly allocated. DBCC SQLPERF - It gives report on current usage of transaction log in percentage. DBCC CHECKFILEGROUP - Checks all tables file group for any damage.
When do you use SQL Profiler?
Answer: SQL Profiler utility allows us to basically track Connections to the SQL Server and also determine activities such as which SQL Scripts are running, failed jobs etc.
Can you explain the role of each service?
Answer: SQL SERVER - is for running the databases SQL AGENT - is for automation such as Jobs, DB Maintenance, Backups DTC - Is for linking and connecting to other SQL Servers.
What is Normalization ?
Answer: The logical design of the database, including the tables and the relationships between them, is the core of an optimized relational database. A good logical database design can lay the foundation for optimal database and application performance. A poor logical database design can impair the performance of the entire system.
Normalizing a logical database design involves using formal methods to separate the data into multiple, related tables. A greater number of narrow tables (with fewer columns) is characteristic of a normalized database. A few wide tables (with more columns) is characteristic of an nonnomalized database. Reasonable normalization often improves performance. When useful indexes are available, the Microsoft® SQL Server™ 2000 query optimizer is efficient at selecting rapid, efficient joins between tables.
Some of the benefits of normalization include:
·Faster sorting and index creation.
·A larger number of clustered indexes. For more information, Narrower and more compact indexes.
·Fewer indexes per table, which improves the performance of INSERT, UPDATE, and DELETE statements.
·Fewer null values and less opportunity for inconsistency, which increase database compactness.
As normalization increases, so do the number and complexity of joins required to retrieve data. Too many complex relational joins between too many tables can hinder performance. Reasonable normalization often includes few regularly executed queries that use joins involving more than four tables.
Sometimes the logical database design is already fixed and total redesign is not feasible. Even then, however, it might be possible to normalize a large table selectively into several smaller tables. If the database is accessed through stored procedures, this schema change could take place without affecting applications. If not, it might be possible to create a view that hides the schema change from the applications.
Can you explain what View is in SQL ?
Answer: View is just a virtual table nothing else which is based or we can say devlop with SQL SELECT query.So we can say that its a real database table (it has columns and rows just like a regular table),but one difference is that real tables store data,but views can’t. View data is generated dynamically when the view is referenced.And view can also references one or more existing database tables or other views. We can say that it is filter of database.
How to get which Process is Blocked in SQL SERVER ?
Answer:- There are two ways to get this sp_who and sp_who2 . You cannot get any detail about the sp_who2 but its provide more information then the sp_who . And other option from which we can find which process is blocked by other process is by using Enterprise Manager or Management Studio, these two commands work much faster and more efficiently than these GUI-based front-ends.
Can you tell me the difference between DELETE &TRUNCATE commands?
Answer: Delete command removes the rows from a table based on the condition that we provide with a WHERE clause. Truncate will actually remove all the rows from a table and there will be no data in the table after we run the truncate command.
a Hide data complexity
b Organise data From Hetrogenious sources
c Reduce Object Size
d Usuful for Combine multiple logical table
e All are True
Ans:a
Which one is true with View:
a It is a permanet table
b It is a temporaray table
c It Is a logical table
d It is a physical table
Ans:c
Which Type of Parameter is not found in Stored Procedure?
a Input
b Output
c Ref
d All
Ans:c
Temporary stored Procedure Is found in :
a Master Database
b Model Database
c Msdb Database
d Temp Database
Ans:d
Which two are the fundamental object of ADO.Net?
a Dataset ,Dataadapter
b DataReader ,DataSet
c DataAdapter ,DataTable
d DataSet ,DataReader
Ans:d
select correct option-the .Net namespaces with the data functionality classes?
a System.Data
b System.Data.OleDB
c System.XML
d All
Ans:
Which isolation level is used for COM+ object?
a READ COMMITTED
b READ UNCOMMITTED
c SERIALIZABLE
d None
Ans:a
What is full form of T-SQL?
a Transfer-SQL
b Transaction-SQL
c Transact-SQL
d None
Ans:c
What is the full form of KPI?
a Key Procedure Indicators
b Key Process Indicators
c Key Performance Indicators
Ans:c
What are the various lock types ?
a Shared
b update
c exclusive
d all
Ans:d
What is the use of CHAR function?
a Convert numeric to char type
b Convert char to numeric type
c convert char to char
d none
Ans:a
Can we create Web service in SQL Server 2005?
we can create web service in sql server 2005 by using an HTTP EndPoint
a No


