Our Users »
bookmark »
»
Contact Us »
Register
Search:
Home
Articles
Interview Questions
Submit
Services
Discussion
Education
Scripting
Forum
Bangalore Helpline
Bangalore FAQ
Directory of News Pappers
Directory of Doctors
Cable Channel List
Bangalore City Guide
Hospitals in India
Famous Doctors in B'lore
About us
Advertise with us
Our Clients
Forgot my Password
Our Users
Register
Help
Login
SqlServer Interview Questions
Q:
What is Normallization
Ans :
Well a relational database is basically composed of tables that contain related data. So the Process of organizing this data into tables is actually referred to as normalization.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a Stored Procedure?
Ans :
Its nothing but a set of T-SQL statements combined to perform a single task of several tasks. Its basically like a Macro so when you invoke the Stored procedure, you actually run a set of statements.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Can you give an example of Stored Procedure?
Ans :
sp_helpdb , sp_who2, sp_renamedb are a set of system defined stored procedures. We can also have user defined stored procedures which can be called in similar way.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a trigger?
Ans :
Triggers are basically used to implement business rules. Triggers is also similar to stored procedures. The difference is that it can be activated when data is added or edited or deleted from a table in a database.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a view?
Ans :
If we have several tables in a db and we want to view only specific columns from specific tables we can go for views. It would also suffice the needs of security some times allowing specfic users to see only specific columns based on the permission that we can configure on the view. Views also reduce the effort that is required for writing queries to access specific columns every time.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is an Index?
Ans :
When queries are run against a db, an index on that db basically helps in the way the data is sorted to process the query for faster and data retrievals are much faster when we have an index.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the types of indexes available with SQL Server?
Ans :
There are basically two types of indexes that we use with the SQL Server. Clustered and the Non-Clustered.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is the basic difference between clustered and a non-clustered index?
Ans :
The difference is that, Clustered index is unique for any given table and we can have only one clustered index on a table. The leaf level of a clustered index is the actual data and the data is resorted in case of clustered index. Whereas in case of non-clustered index the leaf level is actually a pointer to the data in rows so we can have as many non-clustered indexes as we can on the db.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are cursors?
Ans :
Well cursors help us to do an operation on a set of data that we retreive by commands such as Select columns from table. For example : If we have duplicate records in a table we can remove it by declaring a cursor which would check the records during retreival one by one and remove rows which have duplicate values.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
When do we use the UPDATE_STATISTICS command?
Ans :
This command is basically used when we do a large processing of data. If we do a large amount of deletions any modification or Bulk Copy into the tables, we need to basically update the indexes to take these changes into account. UPDATE_STATISTICS updates the indexes on these tables accordingly.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Which TCP/IP port does SQL Server run on?
Ans :
SQL Server runs on port 1433 but we can also change it for better security.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
From where can you change the default port?
Ans :
From the Network Utility TCP/IP properties ?> Port number.both on client and the server.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Can you tell me the difference between DELETE & TRUNCATE commands?
Ans :
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.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Can we use Truncate command on a table which is referenced by FOREIGN KEY?
Ans :
No. We cannot use Truncate command on a table with Foreign Key because of referential integrity.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is the use of DBCC commands?
Ans :
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.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is normalization?
Ans :
Well a relational database is basically composed of tables that contain related data. So the Process of organizing this data into tables is actually referred to as normalization.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a Stored Procedure?
Ans :
Its nothing but a set of T-SQL statements combined to perform a single task of several tasks. Its basically like a Macro so when you invoke the Stored procedure, you actually run a set of statements.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Can you give an example of Stored Procedure?
Ans :
sp_helpdb , sp_who2, sp_renamedb are a set of system defined stored procedures. We can also have user defined stored procedures which can be called in similar way.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a view?
Ans :
If we have several tables in a db and we want to view only specific columns from specific tables we can go for views. It would also suffice the needs of security some times allowing specfic users to see only specific columns based on the permission that we can configure on the view. Views also reduce the effort that is required for writing queries to access specific columns every time.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is an Index?
Ans :
When queries are run against a db, an index on that db basically helps in the way the data is sorted to process the query for faster and data retrievals are much faster when we have an index.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the types of indexes available with SQL Server?
Ans :
There are basically two types of indexes that we use with the SQL Server. Clustered and the Non-Clustered.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is the basic difference between clustered and a non-clustered index?
Ans :
The difference is that, Clustered index is unique for any given table and we can have only one clustered index on a table. The leaf level of a clustered index is the actual data and the data is resorted in case of clustered index. Whereas in case of non-clustered index the leaf level is actually a pointer to the data in rows so we can have as many non-clustered indexes as we can on the db.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are cursors?
Ans :
Well cursors help us to do an operation on a set of data that we retreive by commands such as Select columns from table. For example : If we have duplicate records in a table we can remove it by declaring a cursor which would check the records during retreival one by one and remove rows which have duplicate values.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
When do we use the UPDATE_STATISTICS command?
Ans :
This command is basically used when we do a large processing of data. If we do a large amount of deletions any modification or Bulk Copy into the tables, we need to basically update the indexes to take these changes into account. UPDATE_STATISTICS updates the indexes on these tables accordingly.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Which TCP/IP port does SQL Server run on?
Ans :
SQL Server runs on port 1433 but we can also change it for better security.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
From where can you change the default port?
Ans :
From the Network Utility TCP/IP properties ?> Port number.both on client and the server.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Can you tell me the difference between DELETE & TRUNCATE commands?
Ans :
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.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Can we use Truncate command on a table which is referenced by FOREIGN KEY?
Ans :
No. We cannot use Truncate command on a table with Foreign Key because of referential integrity.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is the use of DBCC commands?
Ans :
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.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Can you give me some DBCC command options?(Database consistency check)
Ans :
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.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What command do we use to rename a db?
Ans :
sp_renamedb ?oldname? , ?newname?
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is default tablespace?
Ans :
The Tablespace to contain schema objects created without specifying a tablespace name.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the system resources that can be controlled through Profile?
Ans :
The number of concurrent sessions the user can establish the CPU processing time available to the user?s session the CPU processing time available to a single call to ORACLE made by a SQL statement the amount of logical I/O available to the user?s session the amount of logical I/O available to a single call to ORACLE made by a SQL statement the allowed amount of idle time for the user?s session the allowed amount of connect time for the user?s session.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is Tablespace Quota?
Ans :
The collective amount of disk space available to the objects in a schema on a particular tablespace.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the different Levels of Auditing?
Ans :
Statement Auditing, Privilege Auditing and Object Auditing.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is Statement Auditing?
Ans :
Statement auditing is the auditing of the powerful system privileges without regard to specifically named objects
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the database administrators utilities available?
Ans :
SQL * DBA - This allows DBA to monitor and control an ORACLE database. SQL * Loader - It loads data from standard operating system files (Flat files) into ORACLE database tables. Export (EXP) and Import (imp) utilities allow you to move existing data in ORACLE format to and from ORACLE database.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
How can you enable automatic archiving?
Ans :
Shut the database Backup the database Modify/Include LOG_ARCHIVE_START_TRUE in init.ora file. Start up the database.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are roles?How can we implement roles?
Ans :
Roles are the easiest way to grant and manage common privileges needed by different groups of database users. Creating roles and assigning provides to roles. Assign each role to group of users. This will simplify the job of assigning privileges to individual users.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are Roles?
Ans :
Roles are named groups of related privileges that are granted to users or other roles.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the use of Roles?
Ans :
REDUCED GRANTING OF PRIVILEGES - Rather than explicitly granting the same set of privileges to many users a database administrator can grant the privileges for a group of related users granted to a role and then grant only the role to each member of the group. DYNAMIC PRIVILEGE MANAGEMENT - When the privileges of a group must change, only the privileges of the role need to be modified. The security domains of all users granted the group?s role automatically reflect the changes made to the role. SELECTIVE AVAILABILITY OF PRIVILEGES - The roles granted to a user can be selectively enable (available for use) or disabled (not available for use). This allows specific control of a user?s privileges in any given situation. APPLICATION AWARENESS - A database application can be designed to automatically enable and disable selective roles when a user attempts to use the application.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is Privilege Auditing?
Ans :
Privilege auditing is the auditing of the use of powerful system privileges without regard to specifically named objects.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is Object Auditing?
Ans :
Object auditing is the auditing of accesses to specific schema objects without regard to user.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is Auditing?
Ans :
Monitoring of user access to aid in the investigation of database use.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a trace file and how is it created?
Ans :
Each server and background process can write an associated trace file. When an internal error is detected by a process or user process, it dumps information about the error to its trace. This can be used for tuning the database.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a profile?
Ans :
Each database user is assigned a Profile that specifies limitations on various system resources available to the user.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Well sometimes sp_reanmedb may not work you know because if some one is using the db it will not accept this command so what do you think you can do in such cases?
Ans :
In such cases we can first bring to db to single user using sp_dboptions and then we can rename that db and then we can rerun the sp_dboptions command to remove the single user mode.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?
Ans :
Having Clause is basically used only with the GROUP BY function in a query. WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What do you mean by COLLATION?
Ans :
Collation is basically the sort order. There are three types of sort order Dictionary case sensitive, Dictonary - case insensitive and Binary.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a Join in SQL Server?
Ans :
Join actually puts data from two or more tables into a single result set.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Can you give me some DBCC command options?(Database consistency check)
Ans :
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.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What command do we use to rename a db?
Ans :
sp_renamedb ?oldname? , ?newname?
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Well sometimes sp_reanmedb may not work you know because if some one is using the db it will not accept this command so what do you think you can do in such cases?
Ans :
In such cases we can first bring to db to single user using sp_dboptions and then we can rename that db and then we can rerun the sp_dboptions command to remove the single user mode.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?
Ans :
Having Clause is basically used only with the GROUP BY function in a query. WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What do you mean by COLLATION?
Ans :
Collation is basically the sort order. There are three types of sort order Dictionary case sensitive, Dictonary - case insensitive and Binary.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a Join in SQL Server?
Ans :
Join actually puts data from two or more tables into a single result set.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Can you explain the types of Joins that we can have with Sql Server?
Ans :
There are three types of joins: Inner Join, Outer Join, Cross Join
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
When do you use SQL Profiler?
Ans :
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..
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a Linked Server?
Ans :
Linked Servers is a concept in SQL Server by which we can add other SQL Server to a Group and query both the SQL Server dbs using T-SQL Statements.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Can you link only other SQL Servers or any database servers such as Oracle?
Ans :
We can link any server provided we have the OLE-DB provider from Microsoft to allow a link. For Oracle we have a OLE-DB provider for oracle that microsoft provides to add it as a linked server to the sql server group.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Which stored procedure will you be running to add a linked server?
Ans :
sp_addlinkedserver, sp_addlinkedsrvlogin
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the OS services that the SQL Server installation adds?
Ans :
MS SQL SERVER SERVICE, SQL AGENT SERVICE, DTC (Distribution transac co-ordinator)
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Can you explain the role of each service?
Ans :
SQL SERVER - is for running the databases SQL AGENT - is for automation such as Jobs, DB Maintanance, Backups DTC - Is for linking and connecting to other SQL Servers
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
How do you troubleshoot SQL Server if its running very slow?
Ans :
First check the processor and memory usage to see that processor is not above 80% utilization and memory not above 40-45% utilization then check the disk utilization using Performance Monitor, Secondly, use SQL Profiler to check for the users and current SQL activities and jobs running which might be a problem. Third would be to run UPDATE_STATISTICS command to update the indexes
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Lets say due to N/W or Security issues client is not able to connect to server or vice versa. How do you troubleshoot?
Ans :
First I will look to ensure that port settings are proper on server and client Network utility for connections. ODBC is properly configured at client end for connection ??Makepipe & readpipe are utilities to check for connection. Makepipe is run on Server and readpipe on client to check for any connection issues.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the authentication modes in SQL Server?
Ans :
Windows mode and mixed mode (SQL & Windows).
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Where do you think the users names and passwords will be stored in sql server?
Ans :
They get stored in master db in the sysxlogins table.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is log shipping? Can we do logshipping with SQL Server 7.0
Ans :
Logshipping is a new feature of SQL Server 2000. We should have two SQL Server - Enterprise Editions. From Enterprise Manager we can configure the logshipping. In logshipping 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 we can use this as the DR (disaster recovery) plan.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Let us say the SQL Server crashed and you are rebuilding the databases including the master database what procedure to you follow?
Ans :
For restoring the master db we have to stop the SQL Server first and then from command line we can type SQLSERVER .m which will basically bring it into the maintenance mode after which we can restore the master db.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Let us say master db itself has no backup. Now you have to rebuild the db so what kind of action do you take?
Ans :
(I am not sure- but I think we have a command to do it).
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is BCP? When do we use it?
Ans :
BulkCopy is a tool used to copy huge amount of data from tables and views. But it won?t copy the structures of the same.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What should we do to copy the tables, schema and views from one SQL Server to another?
Ans :
We have to write some DTS packages for it.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What?s the difference between a primary key and a unique key?
Ans :
Both primary key and unique enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default. Another major difference is that, primary key doesn?t allow NULLs, but unique key allows one NULL only.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Write a SQL Query to find first Week Day of month?
Ans :
SELECT DATENAME(dw, DATEADD(dd, - DATEPART(dd, GETDATE()) + 1, GETDATE())) AS FirstDay
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
How to find 6th highest salary from Employee table
Ans :
SELECT TOP 1 salary FROM (SELECT DISTINCT TOP 6 salary FROM employee ORDER BY salary DESC) a ORDER BY salary
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a join and List different types of joins.
Ans :
Joins are used in queries to explain how different tables are related. Joins also let you select data from a table depending upon data from another table. Types of joins: INNER JOINs, OUTER JOINs, CROSS JOINs. OUTER JOINs are further classified as LEFT OUTER JOINS, RIGHT OUTER JOINS and FULL OUTER JOINS.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
How can I enforce to use particular index?
Ans :
You can use index hint (index=index_name) after the table name. SELECT au_lname FROM authors (index=aunmind)
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is sorting and what is the difference between sorting and clustered indexes?
Ans :
The ORDER BY clause sorts query results by one or more columns up to 8,060 bytes. This will happen by the time when we retrieve data from database. Clustered indexes physically sorting data, while inserting/updating the table.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the differences between UNION and JOINS?
Ans :
A join selects columns from 2 or more tables. A union selects rows.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is the Referential Integrity?
Ans :
Referential integrity refers to the consistency that must be maintained between primary and foreign keys, i.e. every foreign key value must have a corresponding primary key value
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What?s the difference between a primary key and a unique key?
Ans :
Both primary key and unique enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default. Another major difference is that, primary key doesn?t allow NULLs, but unique key allows one NULL only.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Write a SQL Query to find first Week Day of month?
Ans :
SELECT DATENAME(dw, DATEADD(dd, - DATEPART(dd, GETDATE()) + 1, GETDATE())) AS FirstDay
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
How to find 6th highest salary from Employee table
Ans :
SELECT TOP 1 salary FROM (SELECT DISTINCT TOP 6 salary FROM employee ORDER BY salary DESC) a ORDER BY salary
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a join and List different types of joins.
Ans :
Joins are used in queries to explain how different tables are related. Joins also let you select data from a table depending upon data from another table. Types of joins: INNER JOINs, OUTER JOINs, CROSS JOINs. OUTER JOINs are further classified as LEFT OUTER JOINS, RIGHT OUTER JOINS and FULL OUTER JOINS.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
How can I enforce to use particular index?
Ans :
You can use index hint (index=index_name) after the table name. SELECT au_lname FROM authors (index=aunmind)
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is sorting and what is the difference between sorting and clustered indexes?
Ans :
The ORDER BY clause sorts query results by one or more columns up to 8,060 bytes. This will happen by the time when we retrieve data from database. Clustered indexes physically sorting data, while inserting/updating the table.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the differences between UNION and JOINS?
Ans :
A join selects columns from 2 or more tables. A union selects rows.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is the Referential Integrity?
Ans :
Referential integrity refers to the consistency that must be maintained between primary and foreign keys, i.e. every foreign key value must have a corresponding primary key value
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a deadlock?
Ans :
Deadlock is a situation when two processes, each having a lock on one piece of data, attempt to acquire a lock on the other's piece. Each process would wait indefinitely for the other to release the lock, unless one of the user processes is terminated. SQL Server detects deadlocks and terminates one user's process.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a LiveLock?
Ans :
A livelock is one, where a request for an exclusive lock is repeatedly denied because a series of overlapping shared locks keeps interfering. SQL Server detects the situation after four denials and refuses further shared locks. A livelock also occurs when read transactions monopolize a table or page, forcing a write transaction to wait indefinitely.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
How to restart SQL Server in single user mode?
Ans :
From Startup Options :- Go to SQL Server Properties by right-clicking on the Server name in the Enterprise manager. Under the 'General' tab, click on 'Startup Parameters'. Enter a value of -m in the Parameter.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Does SQL Server 2000 clustering support load balancing?
Ans :
SQL Server 2000 clustering does not provide load balancing; it provides failover support. To achieve load balancing, you need software that balances the load between clusters, not between servers within a cluster.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is DTC?
Ans :
The Microsoft Distributed Transaction Coordinator (MS DTC) is a transaction manager that allows client applications to include several different sources of data in one transaction. MS DTC coordinates committing the distributed transaction across all the servers enlisted in the transaction.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is DTS?
Ans :
Microsoft? SQL Server? 2000 Data Transformation Services (DTS) is a set of graphical tools and programmable objects that lets you extract, transform, and consolidate data from disparate sources into single or multiple destinations.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are defaults? Is there a column to which a default can't be bound?
Ans :
A default is a value that will be used by a column, if no value is supplied to that column while inserting data. IDENTITY columns and timestamp columns can't have defaults bound to them.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the constraints ?
Ans :
Table Constraints define rules regarding the values allowed in columns and are the standard mechanism for enforcing integrity. SQL Server 2000 supports five classes of constraints. NOT NULL , CHECK, UNIQUE, PRIMARY KEY, FOREIGN KEY.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is Transaction?
Ans :
A transaction is a sequence of operations performed as a single logical unit of work. A logical unit of work must exhibit four properties, called the ACID (Atomicity, Consistency, Isolation, and Durability) properties, to qualify as a transaction.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is RAID and what are different types of RAID configurations?
Ans :
RAID stands for Redundant Array of Inexpensive Disks, used to provide fault tolerance to database servers. There are six RAID levels 0 through 5 offering different levels of performance, fault tolerance.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the steps you will take to improve performance of a poor performing query?
Ans :
This is a very open ended question and there could be a lot of reasons behind the poor performance of a query. But some general issues that you could talk about would be: No indexes, table scans, missing or out of date statistics, blocking, excess recompilations of stored procedures, procedures and triggers without SET NOCOUNT ON, poorly written query with unnecessarily complicated joins, too much normalization, excess usage of cursors and temporary tables. Some of the tools/ways that help you troubleshooting performance problems are: SET SHOWPLAN_ALL ON, SET SHOWPLAN_TEXT ON, SET STATISTICS IO ON, SQL Server Profiler, Windows NT /2000 Performance monitor, Graphical execution plan in Query Analyzer.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the steps you will take, if you are tasked with securing an SQL Server?
Ans :
Again this is another open ended question. Here are some things you could talk about: Preferring NT authentication, using server, databse and application roles to control access to the data, securing the physical database files using NTFS permissions, using an unguessable SA password, restricting physical access to the SQL Server, renaming the Administrator account on the SQL Server computer, disabling the Guest account, enabling auditing, using multiprotocol encryption, setting up SSL, setting up firewalls, isolating SQL Server from the web server etc.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a deadlock and what is a live lock? How will you go about resolving deadlocks?
Ans :
Deadlock is a situation when two processes, each having a lock on one piece of data, attempt to acquire a lock on the other's piece. Each process would wait indefinitely for the other to release the lock, unless one of the user processes is terminated. SQL Server detects deadlocks and terminates one user's process. A livelock is one, where a request for an exclusive lock is repeatedly denied because a series of overlapping shared locks keeps interfering. SQL Server detects the situation after four denials and refuses further shared locks. A livelock also occurs when read transactions monopolize a table or page, forcing a write transaction to wait indefinitely.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is blocking and how would you troubleshoot it?
Ans :
Blocking happens when one connection from an application holds a lock and a second connection requires a conflicting lock type. This forces the second connection to wait, blocked on the first.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Explain CREATE DATABASE syntax
Ans :
Many of us are used to craeting databases from the Enterprise Manager or by just issuing the command: CREATE DATABAE MyDB. But what if you have to create a database with two filegroups, one on drive C and the other on drive D with log on drive E with an initial size of 600 MB and with a growth factor of 15%? That's why being a DBA you should be familiar with the CREATE DATABASE syntax.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
How to restart SQL Server in single user mode? How to start SQL Server in minimal configuration mode?
Ans :
SQL Server can be started from command line, using the SQLSERVR.EXE. This EXE has some very important parameters with which a DBA should be familiar with. -m is used for starting SQL Server in single user mode and -f is used to start the SQL Server in minimal confuguration mode.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
As a part of your job, what are the DBCC commands that you commonly use for database maintenance?
Ans :
DBCC CHECKDB, DBCC CHECKTABLE, DBCC CHECKCATALOG, DBCC CHECKALLOC, DBCC SHOWCONTIG, DBCC SHRINKDATABASE, DBCC SHRINKFILE etc. But there are a whole load of DBCC commands which are very useful for DBAs.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are statistics, under what circumstances they go out of date, how do you update them?
Ans :
Statistics determine the selectivity of the indexes. If an indexed column has unique values then the selectivity of that index is more, as opposed to an index with non-unique values. Query optimizer uses these indexes in determining whether to choose an index or not while executing a query. Some situations under which you should update statistics: 1) If there is significant change in the key values in the index 2) If a large amount of data in an indexed column has been added, changed, or removed (that is, if the distribution of key values has changed), or the table has been truncated using the TRUNCATE TABLE statement and then repopulated 3) Database is upgraded from a previous version
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the different ways of moving data/databases between servers and databases in SQL Server?
Ans :
There are lots of options available, you have to choose your option depending upon your requirements. Some of the options you have are: BACKUP/RESTORE, dettaching and attaching databases, replication, DTS, BCP, logshipping, INSERT...SELECT, SELECT...INTO, creating INSERT scripts to generate data.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Explian different types of BACKUPs avaialabe in SQL Server? Given a particular scenario, how would you go about choosing a backup plan?
Ans :
Types of backups you can create in SQL Sever 7.0+ are Full database backup, differential database backup, transaction log backup, filegroup backup. Check out the BACKUP and RESTORE commands in SQL Server books online. Be prepared to write the commands in your interview. Books online also has information on detailed backup/restore architecture and when one should go for a particular kind of backup.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is database replicaion? What are the different types of replication you can set up in SQL Server?
Ans :
Replication is the process of copying/moving data between databases on the same or different servers. SQL Server supports the following types of replication scenarios: * Snapshot replication * Transactional replication (with immediate updating subscribers, with queued updating subscribers) * Merge replication
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
How to determine the service pack currently installed on SQL Server?
Ans :
The global variable @@Version stores the build number of the sqlservr.exe, which is used to determine the service pack installed.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a join and explain different types of joins.
Ans :
Joins are used in queries to explain how different tables are related. Joins also let you select data from a table depending upon data from another table. Types of joins: INNER JOINs, OUTER JOINs, CROSS JOINs. OUTER JOINs are further classified as LEFT OUTER JOINS, RIGHT OUTER JOINS and FULL OUTER JOINS.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Can you have a nested transaction?
Ans :
Yes, very much. Check out BEGIN TRAN, COMMIT, ROLLBACK, SAVE TRAN and @@TRANCOUNT
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is an extended stored procedure? Can you instantiate a COM object by using T-SQL?
Ans :
An extended stored procedure is a function within a DLL (written in a programming language like C, C++ using Open Data Services (ODS) API) that can be called from T-SQL, just the way we call normal stored procedures using the EXEC statement. See books online to learn how to create extended stored procedures and how to add them to SQL Server. Yes, you can instantiate a COM (written in languages like VB, VC++) object from T-SQL by using sp_OACreate stored procedure.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is the system function to get the current user's user id?
Ans :
USER_ID(). Also check out other system functions like USER_NAME(), SYSTEM_USER, SESSION_USER, CURRENT_USER, USER, SUSER_SID(), HOST_NAME().
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are triggers? How many triggers you can have on a table? How to invoke a trigger on demand?
Ans :
Triggers are special kind of stored procedures that get executed automatically when an INSERT, UPDATE or DELETE operation takes place on a table.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What does ROLLBACK do?
Ans :
ROLLBACK retracts any of the changes resulting from the SQL statements in the transaction.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is SAVE POINT?
Ans :
For long transactions that contain many SQL statements, intermediate markers or savepoints can be declared which can be used to divide a transaction into smaller parts. This allows the option of later rolling back all work performed from the current point in the transaction to a declared savepoint within the transaction.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the values that can be specified for OPTIMIZER MODE Parameter?
Ans :
COST and RULE.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is COST-based approach to optimization?
Ans :
Considering available access paths and determining the most efficient execution plan based on statistics in the data dictionary for the tables accessed by the statement and their associated clusters and indexes.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What does COMMIT do?
Ans :
COMMIT makes permanent the changes resulting from all SQL statements in the transaction. The changes made by the SQL statements of a transaction become visible to other user sessions transactions that start only after transaction is committed.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is RULE-based approach to optimization?
Ans :
Choosing an executing plan based on the access paths available and the ranks of these access paths. What are the values that can be specified for OPTIMIZER_GOAL parameter of the ALTER SESSION Command? CHOOSE,ALL_ROWS,FIRST_ROWS and RULE.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Define Transaction?
Ans :
A Transaction is a logical unit of work that comprises one or more SQL statements executed by a single user.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is Read-Only Transaction?
Ans :
A Read-Only transaction ensures that the results of each query executed in the transaction are consistent with respect to the same point in time.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a Schema?
Ans :
The set of objects owned by user account is called the schema.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a cluster Key?
Ans :
The related columns of the tables are called the cluster key. The cluster key is indexed using a cluster index and its value is stored only once for multiple tables in the cluster.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is Parallel Server?
Ans :
Multiple instances accessing the same database (Only In Multi-CPU environments)
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the basic element of Base configuration of an oracle Database?
Ans :
It consists of one or more data files. one or more control files. two or more redo log files. The Database contains multiple users/schemas one or more rollback segments one or more tablespaces Data dictionary tables User objects (table, indexes, views etc.,) The server that access the database consists of SGA (Database buffer, Dictionary Cache Buffers, Redo log buffers, Shared SQL pool) SMON (System MONito) PMON (Process MONitor) LGWR (LoG Write) DBWR (Data Base Write) ARCH (ARCHiver) CKPT (Check Point) RECO Dispatcher User Process with associated PGS
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is clusters?
Ans :
Group of tables physically stored together because they share common columns and are often used together is called Cluster.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is an Index?How it is implemented in Oracle Database?
Ans :
An index is a database structure used by the server to have direct access of a row in a table. An index is automatically created when a unique of primary key constraint clause is specified in create table command (Ver 7.0)
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a Database instance? Explain
Ans :
A database instance (Server) is a set of memory structure and background processes that access a set of database files. The process can be shared by all users. The memory structure that are used to store most queried data from database. This helps up to improve database performance by decreasing the amount of I/O performed against data file.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is the use of ANALYZE command?
Ans :
To perform one of these function on an index, table, or cluster: - To collect statistics about object used by the optimizer and store them in the data dictionary. - To delete statistics about the object used by object from the data dictionary. - To validate the structure of the object.. - To identify migrated and chained rows off the table or cluster.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Can you explain the types of Joins that we can have with Sql Server?
Ans :
There are three types of joins: Inner Join, Outer Join, Cross Join
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
When do you use SQL Profiler?
Ans :
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..
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a Linked Server?
Ans :
Linked Servers is a concept in SQL Server by which we can add other SQL Server to a Group and query both the SQL Server dbs using T-SQL Statements.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Can you link only other SQL Servers or any database servers such as Oracle?
Ans :
We can link any server provided we have the OLE-DB provider from Microsoft to allow a link. For Oracle we have a OLE-DB provider for oracle that microsoft provides to add it as a linked server to the sql server group.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Which stored procedure will you be running to add a linked server?
Ans :
sp_addlinkedserver, sp_addlinkedsrvlogin
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the OS services that the SQL Server installation adds?
Ans :
MS SQL SERVER SERVICE, SQL AGENT SERVICE, DTC (Distribution transac co-ordinator)
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Can you explain the role of each service?
Ans :
SQL SERVER - is for running the databases SQL AGENT - is for automation such as Jobs, DB Maintanance, Backups DTC - Is for linking and connecting to other SQL Servers
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
How do you troubleshoot SQL Server if its running very slow?
Ans :
First check the processor and memory usage to see that processor is not above 80% utilization and memory not above 40-45% utilization then check the disk utilization using Performance Monitor, Secondly, use SQL Profiler to check for the users and current SQL activities and jobs running which might be a problem. Third would be to run UPDATE_STATISTICS command to update the indexes
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Lets say due to N/W or Security issues client is not able to connect to server or vice versa. How do you troubleshoot?
Ans :
First I will look to ensure that port settings are proper on server and client Network utility for connections. ODBC is properly configured at client end for connection ??Makepipe & readpipe are utilities to check for connection. Makepipe is run on Server and readpipe on client to check for any connection issues.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the authentication modes in SQL Server?
Ans :
Windows mode and mixed mode (SQL & Windows).
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Where do you think the users names and passwords will be stored in sql server?
Ans :
They get stored in master db in the sysxlogins table.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is log shipping? Can we do logshipping with SQL Server 7.0
Ans :
Logshipping is a new feature of SQL Server 2000. We should have two SQL Server - Enterprise Editions. From Enterprise Manager we can configure the logshipping. In logshipping 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 we can use this as the DR (disaster recovery) plan.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Let us say the SQL Server crashed and you are rebuilding the databases including the master database what procedure to you follow?
Ans :
For restoring the master db we have to stop the SQL Server first and then from command line we can type SQLSERVER .m which will basically bring it into the maintenance mode after which we can restore the master db.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Let us say master db itself has no backup. Now you have to rebuild the db so what kind of action do you take?
Ans :
(I am not sure- but I think we have a command to do it).
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is BCP? When do we use it?
Ans :
BulkCopy is a tool used to copy huge amount of data from tables and views. But it won?t copy the structures of the same.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What should we do to copy the tables, schema and views from one SQL Server to another?
Ans :
We have to write some DTS packages for it.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are the responsibilities of a Database Administrator?
Ans :
Installing and upgrading the Oracle Server and application tools. * Allocating system storage and planning future storage requirements for the database system. * Managing primary database structures (tablespaces) * Managing primary objects (table, views, indexes) * Enrolling users and maintaining system security. * Ensuring compliance with Oracle license agreement * Controlling and monitoring user access to the database. * Monitoring and optimizing the performance of the database. * Planning for backup and recovery of database information. * Maintain archived data on tape * Backing up and restoring the database. * Contacting Oracle Corporation for technical support.
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What is a self join? Explain it with an example.
Ans :
Self join is just like any other join, except that two instances of the same table will be joined in the query. Here is an example: Employees table which contains rows for normal employees as well as managers. So, to find out the managers of all the employees, you need a self join. CREATE TABLE emp ( empid int, mgrid int, empname char(10) ) INSERT emp SELECT 1,2,'Vyas' INSERT emp SELECT 2,3,'Mohan' INSERT emp SELECT 3,NULL,'Shobha' INSERT emp SELECT 4,2,'Shridhar' INSERT emp SELECT 5,2,'Sourabh' SELECT t1.empname [Employee], t2.empname [Manager] FROM emp t1, emp t2 WHERE t1.mgrid = t2.empid Here's an advanced query using a LEFT OUTER JOIN that even returns the employees without managers (super bosses) SELECT t1.empname [Employee], COALESCE(t2.empname, 'No manager') [Manager] FROM emp t1 LEFT OUTER JOIN emp t2 ON t1.mgrid = t2.empid
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
Write down the general syntax for a SELECT statements covering all the options.
Ans :
Here's the basic syntax: (Also checkout SELECT in books online for advanced syntax). SELECT select_list [INTO new_table_] FROM table_source [WHERE search_condition] [GROUP BY group_by_expression] [HAVING search_condition] [ORDER BY order_expression [ASC | DESC] ]
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
Q:
What are cursors? Explain different types of cursors. What are the disadvantages of cursors? How can you avoid cursors?
Ans :
Cursors allow row-by-row prcessing of the resultsets. Types of cursors: Static, Dynamic, Forward-only, Keyset-driven. See books online for more information. Disadvantages of cursors: Each time you fetch a row from the cursor, it results in a network roundtrip, where as a normal SELECT query makes only one rowundtrip, however large the resultset is. Cursors are also costly because they require more resources and temporary storage (results in more IO operations). Furthere, there are restrictions on the SELECT statements that can be used with some types of cursors. Most of the times, set based operations can be used instead of cursors. Here is an example: If you have to give a flat hike to your employees using the following criteria: Salary between 30000 and 40000 -- 5000 hike Salary between 40000 and 55000 -- 7000 hike Salary between 55000 and 65000 -- 9000 hike In this situation many developers tend to use a cursor, determine each employee's salary and update his salary according to the above formula. But the same can be achieved by multiple update statements or can be combined in a single UPDATE statement as shown below: UPDATE tbl_emp SET salary = CASE WHEN salary BETWEEN 30000 AND 40000 THEN salary + 5000 WHEN salary BETWEEN 40000 AND 55000 THEN salary + 7000 WHEN salary BETWEEN 55000 AND 65000 THEN salary + 10000 END
Date submitted :
8/8/2009 1:03:38 AM
Submitted by :
shabir@myfaithsolution.com
Add New Question
1