1. Back To Blog

Important SQL Server interview questions on data types: -What is the difference between

"Char" is a fixed length data type. That means if you create a char of 10 length, it always consumes 10 bytes, irrespective you store 1 character or 10 character. While "varchar" is a variable length data type. That means if you create a "varchar" of 10 length, it will consume length equivalent to the number of characters. So if we store 3 characters, it will only consume 3 bytes.

So if you have data like country code which always consumes 3 characters (USA, IND, NEP etc) "char" data type is a good choice. If you are not sure about the number of characters like "Name" of a person, "varchar" is a better fit.

Also I have created a complete video list of 6 important SQL Server interview question with answers, do have a look at the same.

This question is taken from the lesson "Data types" from my book SQL Server interview questions and answers. 

Here are 15 SQL Server interview question with answer videos which I have recorded at questpond.com, below is the list of questions: -

  • Can you explain First, Second & Third Normal forms in database?
  • What is Denormalization, OLTP and OLAP?
  • Explain Star Schema & Snow Flake Design?
  • State 4 different types of SQL join?
  • What are wild card operators?
  • Explain Union & Union All?
  • What is aggregate functions, group by clause, having keyword?
  • What are subqueries & co-related queries?
  • What are Indexes and how does it increase performance?
  • How indexes Affect insert, update and delete performance (page split)?
  • What is the difference between Clustered and Non-Clustered Indexes?
  • What are triggers,inserted tables and deleted tables?
  • Can you explain instead of and after triggers with a example?
  • What are stored procedures and why do we need them?
  • What are views and can we update views?

Watch below interview questions and answers video on SQL Server covering more than 20 most asked questions:-

Shiv Prasad Koirala

Visit us @ www.questpond.com or call us at 022-66752917... read more

We are on Social