Series: Subject: Topic:

SQL Server Interview Questions

Showing Questions 1 - 20 of 118 Questions
First | Prev | | Next | Last Page
Sort by: 

What is the difference between SQL server,database server and Oracle server?

Asked By: slaser | Asked On: Oct 10th, 2006

Answered by: mbhsye786 on: Jan 13th, 2014

Your answer is incorrect
Sql Server runs only on windows platform and is hardware dependent
where as
Oracle runs in any platform and hardware independent such as can run on unix and windows.

Answered by: Sivaram on: Dec 31st, 2006

Basic Difference

Sql Server:Runs only on windows platform,Hardware independent

oracle:Runs in any platform and hardware dependent..

Full, simple and bulk log recovery models

Asked By: sharath206 | Asked On: Mar 5th, 2008

What is the difference between the full, simple and bulk log recovery models?

Answered by: mbhsye786 on: Jan 13th, 2014

Full recovery model: This model requires log backups, no data is lots due to lost of data file, can be recover data up to point of failure. Bulk Log recovery model: Requires log backups. It is simila...

Answered by: LGSGEEK on: Mar 29th, 2008

SIMPLE: Uses full or differential copies of the database. Truncates the transaction logs automatically. Does not backup the transaction log file(s). Changes made after the last backup cannot be re...

What is the datatype of null?

Asked By: kvmahesh99 | Asked On: Feb 26th, 2013

Answered by: Sharanjit kaur on: Nov 29th, 2013


Can I update views in SQL

Asked By: rahul.solanke | Asked On: Jan 14th, 2012

Can I update views in SQL if yes in what scenarios? if your view is joining multiple tables

Answered by: tinku981 on: Jun 16th, 2013

View can only be updated if it is a simple view. In case you are using INSTEAD OF trigger, simplex or complex view can be updated.

Answered by: abinay on: Oct 6th, 2012

yes,we can update the view as like a table.view is virtual table,basically it is not having any storage data. in a view data will be coming from table.if u delete the table .we wont update the view.

What are the advantages of views ?

Asked By: doodi | Asked On: Apr 9th, 2013

Answered by: Techiee on: Jun 12th, 2013

1. Hiding Unwanted(users do not have right to see those columns e.g login, password column in table) columns from the user.

2. Reduce the complexity of tables from using joins etc. in your query.

Answered by: rinusybase on: May 6th, 2013

Define frequently used joins, projections, and selections as views so that users need not specify all the conditions and qualifications each time an operation is performed on that data. Display diffe...

Indexing on frequently updated table

Asked By: mahmoodbutt | Asked On: Apr 23rd, 2013

I was asked a question in an interview, where I was given a situation which is: i have registered to an online GAMIng website. It displays my rank on the basis of my score when I play a game. database table has 2 columns: 1. Username 2. Score. since the login page was loading very slowly so the programmers...

What is describe command in SQL server?

Asked By: Priya | Asked On: Aug 30th, 2006

What is its purpose?How to use it?

Star Read Best Answer

Editorial / Best Answer

Answered by: suji

View all questions by suji   View all answers by suji

Member Since Sep-2005 | Answered On : Nov 5th, 2011

Here are multiple ways to get the table information. The DESCRIBE command does not exist in MS SQL SERVER. This is an Oracle command used to describe the structure of objects within a given database. To achieve the same task in MSSQL Server, there are a series of stored procedures with the prefix SP_ that can be used. To view the structure of a table within the current database, use the command

  1. sp_help 'TABLE_NAME';

If you would like to see more details, Create your custom procedure

  1. CREATE procedure DESCRIBE
  2. (
  3. @tablename varchar(256)
  4. )
  5. AS
  6. begin
  7. SELECT DISTINCT sCols.colid AS 'order',,, sCols.length
  8. FROM [syscolumns] sCols
  9. INNER JOIN [systypes] sTyps ON sCols.xtype = sTyps.xtype
  10. INNER JOIN [sysobjects] sObjs ON = sCols.[id]
  11. AND UPPER( = UPPER(@tablename)
  12. ORDER BY sCols.colid
  13. end

Here is another alternative way to get the same information

  1. sp_columns 'TableName' (e.g. sp_columns 'Employee')
  2. sp_columns [ @table_name = ] object [ , [ @table_owner = ] owner ]
  3. [ , [ @table_qualifier = ] qualifier ]
  4. [ , [ @column_name = ] COLUMN ]
  5. [ , [ @ODBCVer = ] ODBCVer ]

Here is the usage :

  1. EXEC sp_columns @table_name = 'Department', @table_owner = 'sa';

Contributors for the editorial answer : Kewlshiva, srilakshmi.b, raaghav,kevaburg

Answered by: Saket Kale on: Oct 24th, 2012

sp_help dbo.customers;

worked for me just fine.

Thanks to the OP, this runs perfectly on SQL 2008 R2, do not know about other versions

Answered by: gangireddy on: Feb 22nd, 2012

To see the structure (description ) of the table in Sql Server the followed command surely works....
sp_help person

to display the structure of the table in Sql Server wer use the followed command has the accurate rating ****
sp_help person

SQLdataadapter ,sqlcommand and SQLdatareader

Asked By: sunil thakur | Asked On: Jul 25th, 2012

What are difference between SQLdataadapter ,sqlcommand and SQLdatareader

Answered by: santhosh on: Aug 6th, 2012

sqldatareader means only read the datas in the table..
sqldataadapter means the datas read and writes

Write SQL query for retrieving employee names from employee table who are having salary greater than 5000 without using where clause?

Asked By: Ashok | Asked On: Jul 18th, 2006

Star Read Best Answer

Editorial / Best Answer

Answered by: Parished.D Chennai India

Answered On : Apr 24th, 2007

create table ee (eno int, ename varchar(200), sal int)

insert into ee values(1, 'a', 2000)
insert into ee values(2, 'b', 6000)
insert into ee values(3, 'c', 8000)

select ENO, ENAME, min(sal) AS SAL from ee group by eno,ename having min(sal) > 5000

Answered by: Venkat Rahul on: Jun 5th, 2012

select ename from emp group by ename,sal having sal>5000;

Answered by: Pushpa on: May 3rd, 2012

If we want to check any values to retrieve the data,case is the best.Case statement is simple and easy to understand.

  1. SELECT case when sal>1000 then ename end
  2. FROM emp

How to remove duplicate records from a table?

Asked By: Beena | Asked On: Sep 19th, 2005

Answered by: Vijay on: May 10th, 2012


  2. OR

Answered by: Mally on: Feb 12th, 2012

Good Code...however the code will delete all the duplicates... you may want to add:

delete top(n) clause in your delete statement to exactly delete the required number of records.

Explain normalization and denormalization with examples?

Asked By: Beena | Asked On: Sep 19th, 2005

Answered by: siva on: Apr 27th, 2012

It is good.I understood if you put some brief explanation with data, is very usable to the persons who are not understanding about normalization like me. ...

Answered by: siva on: Apr 27th, 2012

Your Explnation may be good but it was too dificult to understand with out examples

How to find out duplicate records in SQL server?

Asked By: Srinu | Asked On: Apr 5th, 2006

Star Read Best Answer

Editorial / Best Answer

Answered by: Hanif

Answered On : Apr 12th, 2006

we have to use the group by with having command to get the duplicate values. this query shall show the result of only the users have duplicate values in the employee table.

Select columnName From Table_name
Group By columnName
Having count (*) > 1

SELECT  UserID FROM employee
GROUP BY userid
HAVING count( * ) > 1

Answered by: nandu on: Apr 26th, 2012

SELECT YourColumn, COUNT(*) TotalCount
FROM YourTable
GROUP BY YourColumn

Answered by: Ramakant Sahoo on: Dec 23rd, 2011


Can we replace where clause by having clause. ?

Asked By: bhushan13in | Asked On: Feb 14th, 2012

Interviewer ask.. Can we replace where clause by group by clause let say select * from table_name where some_condition so how we replace where clause by group by clause

Answered by: Mark Haynes on: Feb 16th, 2012

As a basic rule of query building: 1. The WHERE clause should be used to limit the number of rows returned by or affected by the a SQL statement. 2. The GROUP BY clause is used to group a selec...

Is there an import command in SQL 2008 for an excel spreadsheet?

Asked By: merlin1106 | Asked On: Nov 21st, 2011

Answered by: suji on: Jan 15th, 2012

From your SQL Server Management Studio, you open Object Explorer, go to your database where you want to load the data into, right click, then pick Tasks > Import Data. Select the options based on the excel file

How is the error handling in stored proc of T-SQL ?

Asked By: ajay_shu007 | Asked On: Jun 19th, 2008

1 how is the error handling in stored proc of T-SQL2 what is clustered index and non-clustered index? How many clustered indexes and non-clustered indexes can be created in one table? 3-what is disconnected mode?

Answered by: Pradeep Kumar Sharma on: Dec 25th, 2011

Begin Try

End Try
Begin Catch

Declare @errMsg varchar(1000),@errSev int
select @errMsg=error_message(),@errSev=error_severity()

End Catch

Answered by: kirangiet on: Aug 16th, 2010

1) CLR is integrated in SQL Server 2005. Hence we can use below code for Exception Handling. BEGIN TRY SELECT * FROM Employees; END TRY BEGIN CATCH SELECT ERROR_NUMBER() ...

Representing SQL server objects

Asked By: polkam.raju | Asked On: Sep 23rd, 2009

How do represent objects in SQL server? Is it possible? If yes, how?If not? Why?

Answered by: Lokesh M on: Dec 12th, 2011

Try using Server Management Objects (SMO) classes

Covering indexes

Asked By: psingla | Asked On: Mar 9th, 2010

List down the advantage and disadvantages of covering indexes.

Answered by: Lokesh M on: Dec 12th, 2011

Covering Indexes are useful for Input / Output intensive workloads.
Covering indexes are smaller in size
Covering Indexes are sorted by values
It is easier to cache date in Covering Indexes

Covering Indexes cannot be used to select all the columns / entire table.

Run PL/SQL block from SQL server

Asked By: vrushali | Asked On: Jan 18th, 2011

How do you run PL/SQL block from SQL server

Answered by: Lokesh M on: Dec 12th, 2011

Try these and see...

Go To Options -> Run SQL
Set "Statement Delimiter" to None

Go To Options -> Technical Parameters
Tick "Use SQLExecDirect"

First | Prev | | Next | Last Page





twitter fb Linkedin GPlus RSS


Interview Question

 Ask Interview Question?


Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.