SQL Developers Interview Questions and Answers for Freshers – Part 1

Following are SQL Developers Interview Questions and Answers for Freshers.


1. What is a Database?

A database is a collection of meaningful information organised in a manner that can be used whenever there is a requirement for data. It is a collection of data objects like tables, views, schema and logins etc.

2. What are the different Codd’s rule?

– Relational Database Management
– Information Representation
– Logical Accessibility
– Representation of null values
– Catalog facilities
– Data Language
– View Updatability
– Physical data independence
– Logical data independence
– Integrity Constraints
– Database Distribution
– Non Subversion

3. Explain different types of relationships in database.

One to One (1:1): One element of an entity has relation to one and only one element of another entity. e.g.: One employee has one and only one employee number.

One to Many (1: N): An element of any entity may have relation to one element of another element. e.g. one employee can belong to only one department but one department may have more than one employee.

Many to Many (N: N): Many elements of an entity are related to more than one element of another entity. e.g. One supplier can supply many products and similarly one products may be supplied by more than one supplier.

4. Explain Primary Key.

A primary key is one or more column(s) in a table used to uniquely identify each row. NOT NULL constraint is active on it which means you cannot keep column as blank and data across the column(s) must be unique.

5. How to rename a table?

To rename a table use sp_rename oldTableName, NewTableName

6. How to view columns definition in a table?

by executing sp_columns TableName

7. What is the syntax to drop a column?


8. What is the difference between primary key and unique key?

Primary key do not allow NULL value whereas unique key allows one NULL.

9. What are the difference between DELETE and TRUNCATE?

a. You can rollback after DELETE but after performing TRUNCATE you cannot rollback.
b. DELETE locks the table row whereas TRUNCATE locks the entire table.
c. DELETE do not reset identity value whereas TRUNCATE resets identity of table.
d. DELETE is DML command whereas TRUNCATE is DDL command.
e. You can use WHERE clause with DELETE to filter the data but you cannot use WHERE clause with TRUNCATE.

10. What is an alias?

When you want to give a short name or different name to a table its called alias and you can use that alias on behalf of table name or can use with column name in where clause or join clause etc.

Reference: Manzoor Siddiqui [www.SQLServerLog.com]

You may also like...

1 Response

  1. Igor says:

    I would say the answer 9.a is not true:
    9. What are the difference between DELETE and TRUNCATE?
    a. You can rollback after DELETE but after performing TRUNCATE you cannot rollback.
    For instance, in MS SQL Server, there is no problem to do rollback after TRUNCATE. It works fine, no data removed from the truncated table after rollback.

Leave a Reply

Your email address will not be published.