Saturday, June 13, 2009

SQL Server Interview Questions -- Part 1

1. What is a Database ?
Ans: A database is a structured collection of data in computer using one of the database models.

2. What is a Database Management System ?
Ans: A Database Management System (DBMS) is a software that organizes and manages the data in the database.

3. What is a Relational Database Management System ?
Ans: A Relational Database Management System (RDBMS) is a DBMS that uses relational database model. Relational database model is one that organizes data in Attributes(columns) and Tuples(Rows).

4. What is normalization ?
Ans: Normalization is the process of reducing the redundancy in data in the RDBMS.

5. What is de-normalization ?
Ans: De-normalization is the process of introducing controlled redundancy of data in the RDBMS. It is the reverse process of normalization.

6. How to create a table and insert the data, from another table in the same database, in one query ?
Ans: Select * into table2 from table1

7. How to create a table structure and not data, from another table in the same database, in one query ?
Ans: Select * into table2 from table1 where 1 = 2
Here we can give any where clause that doesnot return any rows.

8. Write a simple insert statement to insert one row into employee table whose employee id is 1, name is Joe Paul.
Ans: insert into employee (employee_id, first_name, last_name) values (1, 'Joe', 'Paul')

9. Write a simple delete statement to delete user with id 2 from the system
Ans: Delete from employee where employee_id = 2

10. Write an update statement to give 2.3% increase in salary for all employees in compensation table
Ans: update compensation set salary = salary + (salary * (2.3/100))

No comments:

Post a Comment