SQL Server Interview Questions Differences in part 1

1) What is the difference between Sql and PL/Sql ?

     Sql

     1) Sql is a data oriented language for slecting and manipulation sets of data.

     2) Sql is executed one statement at a time

     3) Sql is used to code queries like DML and DDL statements

     4) Sql doesnot provide conditional branching and conditional looping statements.

     5) Sql doesnot providse proper error handling mechanisums

     6) We can Embed sql in PL / SQL program

     PL / Sql

     1) PL / Sql will provide under procedural programing language to create applications

     2) PL / Sql is executed as a block of code.

     3) Sql is used to code program blocks,triggers,functions,procedures and packages

     4) PL / Sql provide conditional branching and looping and error handling.

     6)  We can not Embed PL / SQL with in a sql statement

2) What is the difference between char,varchar ?

     char

      1) char is fixed length data type

      2) char will store in non-unicode characters

      3) char occupies 1 byte of space for each character

    varchar

      1) varchar is variable length data type

      2) varchar will store in non-unicode characters

      3) varchar occupies 1 byte of space for each character

3) What is the difference between nchar,nvarchar ?

      nchar

      1) nchar is fixed length data type

      2) nchar will store in unicode characters

      3) nchar occupies 2 byte of space for each character

    nvarchar

      1) nvarchar is variable length data type

      2) nvarchar will store in unicode characters

      3) nvarchar occupies 2 byte of space for each character

4) What is the difference between Primary key and Unique key?

      Unique key

      1) Unique key constraint  allows a single null value

      2) We can create multiple Unique key constratins on single table

      Primary key

     1) Primary key constraint does not allows a single null value also

      2) We can create only one Primary key constratins on single table

5) What is the difference between Null and Not Null constraints?

     Null

      If null constraint is imposed on any column that cloumn will allow Null values in to it

     Not Null

      If Not Null constraint is imposed on any column that cloumn will not allow Null values in to it

6)  What is the difference between a Drop Table and Truncate Table?

      Drop Table

     1) Drop Table deletes the table itself

     2) Result is table,underlying Indexes,constraints etc...  are aslo deleted

     Truncate Table

     1) Truncate deletes the entire data in a table

     2) Table structure ,underlying Indexes,constraints etc...  are also still avaliable

7) What is the difference between a Delete and Truncate ?

    Delete

    1) Delete is every record that is deleted is written/logged in the transaction log of the    database,there by enabling the user to recover what was deleted

    2) A delete statement can be controlled by using a filtering condition,i.e where clause

   Truncate

    1) Truncate is deletes the entire data of the table ,it does not write in log files and it is so quit fast.

    2) In truncate will not use where condition
     

8) What is the difference between a Where clause and Having clause ?

     Where clause

    1) Where clause is used to restrecting the data (Rows) , where all the rows which does not satisfy a          given condition

    2) Where is used if we want to perform any restrictions before grouping

    3) Where can be used individally

    4) Aggregate functions can not be used with where clause

    Having clause

    1) Having clause is used to restrecting the data with group by

    2) Having is used if we want to perform any restrictions after grouping

    3) Having clause can be used only in combination with group by

    4) Aggregate functions can be used along with having clause

9) What is the difference between Union and Unionall ?

   Union

   1) Combines the results of two or more queries into a single result set that includes all the rows that          belong to all queries in the union eliminating duplicates

   2) UNION uses a Distinct sort

   3) UNION can not work with a column that has a TEXT data type

   4) UNION less faster than UNIONALL

  UnionAll

   1) Combines the results of two or more queries into a single result set that includes all the rows that           belong to all queries in the unionall will not eliminating duplicates

   2) UNIONAll does not uses a Distinct sort

   3) UnionAll can work with all data types columns

   4) UNIONALL Slightly faster than UNION

10) What is the difference between UNION and JOIN

    UNION combines rows from two or more tables

    JOIN combines columns from two or more tables

About Author: author 4 + years of Information Technology experience in understanding and analyzing the software and hardware engineering requirements, onsite and offshore management of product development. Expert work on design and development for windows,web,mobile Expert knowledge of C#,ADO.NET, ASP.Net MVC, ENTITY FRAMEWORK, LINQ,COLLECTIONS, JAVASCRIPT,AngularJs 1.0,Angular2, Jquery,Jquery-Ajax, SQL SERVER, XAML,Windows phone 8.1 Good knowledge of WCF-Restful services,WCF, WEB API-Services ,Web- Services,MIcrosoft-Azure,JUICE UI,HTML,CSS,AJAX Read More...

Join him on Google+ | Facebook | Linkedin

3 comments

  1. Hello Mate,


    What a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this.

    So I am a new assignment and the client has an SQL AG in a 2 nodes windows cluster with a fileshare as witness.
    I am given the sysadmin permissions but not the local admin or the cluster manager permissions.

    I would like to know in this case
    can I move AG to different node in case I need to?
    Unfortunately for me this is the only AG setup client has and it is their most critical server so I do not have a luxury to test this myself.
    I am sure client will be happy to give me necessary elevated permissions if I need it. But I would like to know for sure if it is indeed needed.

    Anyways great write up, your efforts are much appreciated.


    Obrigado,
    Ajeeth Kapoor

    ReplyDelete