Select chapter



Basics (2.papers)
Data Types (2.papers)
Table-designing (1.papers)
Queries-Commands (3.papers)
String functions (2.papers)
Subqueries (1.papers)
Joins (1.papers)
Constraints (1.papers)
Triggers (1.papers)
Hide

Sponsored Links


  

sql basics interview questions and answers

1
How to declare a table variable in SQL?
  1. declare @variable_name table
    (
      column_name1 datatype [(size)],
    …….
    )
  2. declare #variable_name table
    (
      column_name1 datatype [(size)],
    …….
    )
  3. declare ##variable_name table
    (
      column_name1 datatype [(size)],
    …….
    )
  4. None of the above
Show Answer
Share Facebook gmail Twitter
2
How to insert data into a table variable?
  1. declare @v table (col1 int, col2 varchar(20));
    insert into @v values (1,'somevalues');
    
  2. declare @v table (c1 int, c2 varchar(20));
    set @v=(1,'somevalues');
  3. declare @v table (col1 int, col2 varchar(20));
    add into @v values (1,'somevalues');
    
  4. None of the above
Show Answer
Share Facebook gmail Twitter
3
Which of the following statements are correct about table variable?
  1. The following statement will not work.
    select * into @tablevariable from source_table;
  2. Foreign key constraint is not 
    allowed in the declaration of table variable.
  3. Primary key, not null,check, default and unique constraints are allowed in table variable declaration .
  4. All the options are correct.
Show Answer
Share Facebook gmail Twitter
4
Which of the following syntax is used for declaring single line comments in SQL?
  1.  -- single line comment
  2. //single line comment
  3. ///single line comment
  4. /* single line comment */
Show Answer
Share Facebook gmail Twitter
5
Which of the following syntax is used for declaring multi line line comments in SQL?
  1.  -- multi line comment --
  2. //multi line comment //
  3. ///multi line comments ///
  4. /*multi
    line
    comments */
Show Answer
Share Facebook gmail Twitter
6
How to handle exceptions in SQL Server?
  1. using raiserror function.
  2. using try and catch blocks.
  3. using try,catch and finally blocks.
  4. None of the above.
Show Answer
Share Facebook gmail Twitter
7
What is the use of raiserror function in SQL Server?
  1. raiserror function used for raising and returning custom exception to the calling applications.
  2. raiserror function used for handling exceptions.
  3. raiserror function can be used for handling custom exceptions.
  4. None of the above
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
Read more papers :