DBA > Interview Resource

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


When designing a database table, how do you avoid missing column values for non-primary key columns?

Use DEFAULT and NOT NULL constraints


Which of the following is the syntax for creating an Index?

CREATE [UNIQUE] INDEX index_name ON tbl_name (index_columns)


Which of the following constraints can be used to enforce the uniqueness of rows in a table?

PRIMARY KEY and UNIQUE constraints


Which one of the following must be specified in every DELETE statement?

Table Name


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

True


Which of the following commands is used to change the structure of table?

ALTER TABLE