Database developer interview questions

  1. Which of the following has the highest order of precedence?

    1. Functions and Parenthesis
    2. Multiplication, Division and Exponents
    3. Addition and Subtraction
    4. Logical Operations
  2. When designing a database table, how do you avoid missing column values for non-primary key columns?
    1. Use UNIQUE constraints
    2. Use PRIMARY KEY constraints
    3. Use DEFAULT and NOT NULL constraints
    4. Use FOREIGN KEY constraints
    5. Use SET constraints

  3. Which of the following is the syntax for creating an Index?
    1. CREATE [UNIQUE] INDEX index_name OF tbl_name (index_columns)
    2. CREATE [UNIQUE] INDEX OF tbl_name (index_columns)
    3. CREATE [UNIQUE] INDEX ON tbl_name (index_columns)
    4. CREATE [UNIQUE] INDEX index_name ON tbl_name (index_columns)
  4. Which of the following is not a valid character datatype in SQL Server?
    1. BLOB
    2. CHAR
    3. VARCHAR
    4. TEXT
    5. VARTEXT
  5. Which of the following statements about SQL Server comments is false?
    1. /* … */ are used for multiline comments
    2. // is used for single line comments
    3. – is used for single line comments
    4. Nested comments are allowed i.e. /* comment 1 /* comment 2 */ comment 1*/
    5. ‘ is used for single line comments
  6. Consider the following transaction code:
    Begin Transaction
    Update names_table set employee_name = "Ramesh" where employee_name = "Mahesh"
    Save Transaction SAVE_POINT
    Update salaries set salary=salary + 900 where employee_job = "Engineer"
    Rollback transaction
    Commit transaction
    What will be the result produced by this transaction?
    
    1. “Ramesh” will be updated to “Mahesh”, but salaries of engineers will not be updated
    2. Neither “Ramesh” will be updated to “Mahesh”, nor the salary of engineers will be updated.
    3. “Ramesh” will be updated to “Mahesh” and salary of engineers will also be updated.
  7. Which of the following constraints can be used to enforce the uniqueness of rows in a table?
    1. DEFAULT and NOT NULL constraints
    2. FOREIGN KEY constraints
    3. PRIMARY KEY and UNIQUE constraints
    4. IDENTITY columns
    5. CHECK constraints
  8. Which of the following are not date parts?
    1. quarter
    2. dayofweek
    3. dayofyear
    4. weekday
  9. The IF UPDATE (column_name) parameter in a trigger definition will return TRUE in case of an INSERT statement being executed on the triggered table:
    1. Yes
    2. No
    3. It returns TRUE only if an UPDATE query is executed
    4. Both b and c
  10. Which one of the following must be specified in every DELETE statement?
    1. Table Name
    2. Database name
    3. LIMIT clause
    4. WHERE clause
    5. Column Names
  11. Which one of the following correctly selects rows from the table myTable that have null in column column1?
    1. SELECT * FROM myTable WHERE column1 is null
    2. SELECT * FROM myTable WHERE column1 = null
    3. SELECT * FROM myTable WHERE column1 EQUALS null
    4. SELECT * FROM myTable WHERE column1 NOT null
    5. SELECT * FROM myTable WHERE column1 CONTAINS null
  12. Is this statement true or false: A cursor is a pointer that identifies a specific working row within a set
    1. True
    2. False
  13. Which of the following commands is used to change the structure of table?
    1. CHANGE TABLE
    2. MODIFY TABLE
    3. ALTER TABLE
    4. UPDATE TABLE
This entry was posted in Database. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

25 Comments on Database developer interview questions

  1. Jaimin
    Posted 6/10/2006 at 2:54 am | Permalink

    2. When designing a database table, how do you avoid missing column values for non-primary key columns?
    Use DEFAULT and NOT NULL constraints

    3. Which of the following is the syntax for creating an Index?
    CREATE [UNIQUE] INDEX index_name ON tbl_name (index_columns)

    7. Which of the following constraints can be used to enforce the uniqueness of rows in a table?
    PRIMARY KEY and UNIQUE constraints

    10. Which one of the following must be specified in every DELETE statement?
    Table Name

    12. Is this statement true or false: A cursor is a pointer that identifies a specific working row within a set
    True

    13. Which of the following commands is used to change the structure of table?
    ALTER TABLE

  2. ac
    Posted 6/13/2006 at 1:52 pm | Permalink

    1. 2

  3. ac
    Posted 6/13/2006 at 1:52 pm | Permalink

    4. 1

  4. ac
    Posted 6/13/2006 at 1:56 pm | Permalink

    6. 2

  5. ac
    Posted 6/13/2006 at 2:11 pm | Permalink

    8.1

    11. 1

  6. ac
    Posted 6/13/2006 at 2:14 pm | Permalink

    5. 3

  7. Rashmi Babtiwale
    Posted 7/3/2006 at 5:28 am | Permalink

    if a cursor fetches a ‘null’ record, what value will we have for its respective %found? Will it return true or false?

  8. nash
    Posted 8/26/2006 at 12:36 am | Permalink

    What are the avantages of stored procedure over triggers?
    Distinguish stored procedure and trigger?
    how to make function return more than one value?
    Difference between function and procedure?
    Are triggers Precompiled?

  9. nash
    Posted 8/26/2006 at 1:02 am | Permalink

    What is the difference between Inner join and self join

  10. nash
    Posted 8/26/2006 at 1:31 am | Permalink

    Display Duplicate Values of a single Table?

  11. Priya
    Posted 11/16/2006 at 9:18 pm | Permalink

    For Q7:Primary key and unique constraints

  12. Rathi
    Posted 11/16/2006 at 9:19 pm | Permalink

    For Q1:Functions and paranthesis

  13. Rathi
    Posted 11/16/2006 at 9:21 pm | Permalink

    For Q8:Quarter

  14. Baliram Suryawanshi
    Posted 1/20/2007 at 11:12 am | Permalink

    Dear All,
    I feel nice after looking the simple but useful questions on SQL.
    I have tried to solve these questions on my best level.. Some answers may be incorrect.. Please correct any ans is wrong.

    Thnaks..

    Baliram

    1. Functions and Parenthesis

    2. Use DEFAULT and NOT NULL constraints

    3. CREATE [UNIQUE] INDEX ON tbl_name (index_columns)

    7. IDENTITY columns

    8. quarter is not a date part

    10. Table name must be specified in every DELETE statement.

    11. ” SELECT * FROM myTable WHERE column1 is null ”
    will selects rows from the table myTable that have null in column column1

    12. True

    13. ALTER TABLE command is used to change the structure of table

  15. Mubeen
    Posted 2/12/2007 at 7:49 pm | Permalink

    Q4. Text

  16. Krishnakumar.C
    Posted 3/5/2007 at 4:46 pm | Permalink

    #6,

    Ans:

    “Ramesh” will be updated to “Mahesh”, but salaries of engineers will not be updated

  17. sonu nimdia
    Posted 3/29/2007 at 4:27 am | Permalink

    please find the correct answers

    Q.1 :- a
    Q.2 :- c
    Q.3 :- d
    Q.4 :- e
    Q.5 :- e
    Q.6 :-a
    Q.7 :- c
    Q.8 :-a
    Q.9 :- d
    Q.10:-a
    Q.11:-a
    Q.12:-a
    Q.13:-c

  18. Sadashiva
    Posted 4/11/2007 at 6:40 am | Permalink

    Answers:-

    1 -> 1
    2 -> 3
    3 -> 3
    4 -> 5
    5 -> There are more thn one false statements in the question
    6 -> 1 (The rollback will be done starting from the save point)
    7 -> 3
    8 -> 1
    10 -> 1
    11 -> 1
    12 -> 1
    13 -> 3

  19. Sadashiva
    Posted 4/11/2007 at 6:45 am | Permalink

    Question:-

    Display Duplicate Values of a single Table?

    Answer:-

    The following SQL Command will display all the values which are stored more than once in the column COL1 in table TBL1

    select COL1,count(COL1) as No_of_Times
    from TBL1
    group by COL1
    having count(COL1)>1

    If you want to check for the combination of more than one column then add the same in select clause and group clause.

  20. Sadashiva
    Posted 4/11/2007 at 6:51 am | Permalink

    Question:-

    What is the difference between Inner join and self join?

    Answer:-

    Inner Join - With an inner join, column values from one row of a table are combined with column values from another row of another (or the same) table to form a single row of data based on join condition

    Self Join - A self-join is a query in which a table is joined (compared) to itself. Self-joins are used to compare values in a column with other values in the same column in the same table

  21. Abhishek
    Posted 6/13/2007 at 11:30 pm | Permalink

    ————-
    2.(2 and 3);
    ———–
    4.(4);
    ———-

    —————
    6 .(1);
    —————–
    7.(3)

    —————–
    10.(1)
    —————————————
    11–Which one of the following correctly selects rows from the table myTable that have null in column column1?
    SELECT * FROM myTable WHERE column1 is null ..
    ———————————-
    12 Is this statement true or false: A cursor is a pointer that identifies a specific working row within a set
    ans true
    ———————————
    13Which of the following commands is used to change the structure of table?

    ans ALTER TABLE

  22. Abhishek sant
    Posted 6/13/2007 at 11:34 pm | Permalink

    Distinguish stored procedure and trigger?
    ans the main Diffrence between is that the trriger is execute implicitly where as procudere is executed explicitly..
    triger is fired on a particula event ..
    like insert update delete
    whereas Procuedure can be executed with or without event

  23. Anil kapil
    Posted 11/14/2007 at 7:36 am | Permalink

    1 -> 1
    2 -> 3
    3 -> 4
    4 -> 5
    5 -> 4,5
    6 -> 2
    7 -> 3
    8 ->
    9) -> 4
    10 -> 1
    11 -> 1
    12 -> 2
    13 -> 3

  24. viral rami
    Posted 6/12/2008 at 11:38 pm | Permalink

    Q. 6 ans is –> 1
    Q. 10 ans is –> a

  25. Sandhya
    Posted 1/2/2009 at 4:07 am | Permalink

    1. Functions and Parenthesis
    3. CREATE [UNIQUE] INDEX index_name ON tbl_name (index_columns
    4. Blob
    TEXT
    VARTEXT
    5. // is used for single line comments
    – is used for single line comments
    Nested comments are allowedi.e. /*comment 1 /* comment 2 */ comment 1*/

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*