SQL Server Interview Questions

Ques. What are the different type of SQL's statements ?

Ans. 1. DDL – Data Definition Language DDL is used to define the structure that holds the data. For example, Create, Alter, Drop and Truncate table. 2. DML– Data Manipulation Language DML is used for manipulation of the data itself. Typical operations are Insert, Delete, Update and retrieving the data from the table. Select statement is considered as a limited version of DML, since it can't change data in the database. But it can perform operations on data retrieved from DBMS, before the results are returned to the calling function. 3. DCL– Data Control Language DCL is used to control the visibility of data like granting database access and set privileges to create tables etc. Example - Grant, Revoke access permission to the user to access data in database.

Ques. What are the Advantages of SQL?

Ans. 1. SQL is not a proprietary language used by specific database vendors. Almost every major DBMS supports SQL, so learning this one language will enable programmers to interact with any database like ORACLE, SQL ,MYSQL etc. 2. SQL is easy to learn. The statements are all made up of descriptive English words, and there aren't that many of them. 3. SQL is actually a very powerful language and by using its language elements you can perform very complex and sophisticated database operations.

Ques. what is a field in a database ?

Ans. A field is an area within a record reserved for a specific piece of data. Examples: Employee Name, Employee ID etc

Ques. What is a primary key?

Ans. A primary key is a column whose values uniquely identify every row in a table. Primary key values can never be reused. If a row is deleted from the table, its primary key may not be assigned to any new rows in the future. To define a field as primary key, following conditions had to be met : 1. No two rows can have the same primary key value. 2. Every row must have a primary key value 3. The primary key field cannot be null 4. Values in primary key columns can never be modified or updated

Ques. What is a Composite Key ?

Ans. A Composite primary key is a type of candidate key, which represents a set of columns whose values uniquely identify every row in a table. For example - if "Employee_ID" and "Employee Name" in a table is combined to uniquely identify a row its called a Composite Key.

Post Question