Pages

Follow us on Facebook

SQL Server theory questions.


What is SQL?
Ans: SQL is a structured query language qhich is used to communicate with the SQL Server. Insert, update ,delete operations can be done by using this.

What is SQL Server?
A SQL Server is a relational database management system that uses SQL as standard relational database language.

Which are subsets used in SQL?
Ans: SQL subsets are as follows:
1. DDL
2. DML
3. DCL

DDL: It is a data defination language which is used to make or alter the schema of SQL Server objects. Such as to make table, delete table or to alter the table, view etc.

DML: It is a data manipulation language which is used to manipulate the data in SQL. Such as insert, update, delete operations in sql.

DCL:It is a data control language which is usefull to control access to the database. Such as to grant specific user for perfming specific task or to cancel previously denied or granted permissions.


What is table in SQL?
A table is a set of organised data. It contains columns and rows.

How many indexes are there in SQL Server?
Ans: There are three indexes are in sql server.
1. Unique imdex
2. Clustered index
3. Non clustered index

Unique index: It does not allow to have repeated or duplicate values in a single column.

Clustered Index: It is a index which physically reorders the the structures of column to make searching of records faster.

Non clustured index: It is the index which does not alter the physical structure of the data and it maintains the logical order of the data. Each table can have 999 nonclustured index.


What is the difference between SQL and SQL Server?
ANS: SQL is a structered query language which is used to communicate with the SQL Server to manage the data.
SQL Server is the relational database management system that uses SQL to manipulate the data.


What are the diff types of Joins in SQL Server?
Ans: There are main 4 types of join n sql Server.
1. Inner join
2. Outer join
3. Self join
4. Cross join
Examples on this you can see in joins section on main home page of this blog.

What is the diff between Primary key and Unique key?
Ans: Primary key: Primary key is the combination of Unique and not null key which uniquely identify each record in a column and does not allow null or duplicate record in the that column.

Unique key: It is the key which does not allow duplicate values in a single column.

Not null key: It is the key which does not allow null values in that column and only one null value is allowed.

What are constraints in SQL Server?
Ans: The are following types of constraints.
1. Primary key constraints
2. Unique key
3. Not null key
4. Default key
5. Foreign key
6. Check constrains
7. Index

What is the difference between delete and truncate?
And:
1. Delete command works on rows and truncate command works on table i.e schema of the table.
2. Delete command is used to delete some rows using where clause whereas truncate is used to delete all rows in table.
3. Delete command does not reset the structure of the table but truncate command reset the structure of the table such as Identity key when used with truncate command it again starts with starting values.
4. Using delete command rollback is possible whereas using truncate command rollback is not possible.

What is ACID property in sql server?
Ans: ACID property is used to ensure the transaction is completely executed or not. It is acronym for
1Atomicity: It means that all the operations are executed or none are executed.
2. Consistency: It means that the data must meet all validation rules that means your transaction never leaves your database state without completing its state.
3. Isolation: It means that all the operations are executed independently and if one operation is depend on other then it will wait to execute first operation then the second operation is executed.
4. Durability: The executed opeation will be saved in durable storage once the transaction is completed.