SQL Server interview questions & Answers 7

What is the Difference between 'Count' and ‘Count(*)'?

'Count': Counts the number of non-null values.

‘Count (*)': Counts the number of rows in the table, including null values and duplicates.

 

 

Can you create UNIQUE and PRIMARY KEY constraints on computed columns in SQL Server 2000?

In sql server 2000 we can create the unique and primary key constraint in computed column but in sql server 2005 we cannot create the unique and primary constraints in computed column.

 

 

How to count the number of duplicate items in a table?

Select count(column), column from table group by column having count(column) > 1.

 

How do I list the available tables in a database I'm querying?

You can get a list of tables in a database by calling the INFORMATION_SCHEMA.Tables view like this:

SELECT * FROM information_schema.tables


0 Response to "SQL Server interview questions & Answers 7"

Post a Comment