SQL Interview Questions
1 .
What is the use of the NVL function?
NVL function is used to convert the null value to its actual value.
2 .
What is the difference between DELETE and TRUNCATE?
The differences are:
The basic difference in both is DELETE command is DML command and the TRUNCATE command is DDL.

DELETE command is used to delete a specific row from the table whereas the TRUNCATE command is used to remove all rows from the table.

We can use the DELETE command with WHERE clause but cannot use the TRUNCATE command with it.
3 .
What is SAVEPOINT in a transaction control
A SAVEPOINT is a point in a transaction when you can roll the transaction back to a certain point without rolling back the entire transaction.
1 row inserted.
1 row inserted.
Rollback complete.
-------- -----------
1  Savepoint A
4 .
What is a set-based solution?
Cursors operate on individual rows, and in case of a set, it works on a resultant set of data, which could be a table/view or a join of both. The resultant set is an output of a SQL query.
5 .
Name a few important DDL commands present in the SQL?
They are generally preferred when it comes to defining or changing the structure of a specific database in the shortest possible times due to security and other concerns. Some of the commands that can be applied and considered directly for this are as follows.
* Create
* Alter
* Drop
* Rename
* Truncate
* copy
6 .
What do you know about the NULL value in the SQL?
It is basically a field which doesn’t have any value in SQL. It is totally different from that of a zero value and must not be put equal or confused with the same. These fields are left blank during the creation of the records.
7 .
About The SQL Buffer?
* All Commands of SQL are Typed at the SQL prompt.
* Only One SQL Statements is Managed in The SQL Buffer.
* The Current SQL Statement Replaces the Previous SQL Statement in the Buffer.
* The SQL Statement Can be Divided Into Different Lines Within The SQL Buffer.
* Only One Line i.e., The Current Line Can be Active at a Time in the SQL Buffer.
* At SQL Prompt, Editing is Possible Only in The Current SQL Buffer Line.
* Every Statement of SQL should be terminated Using Semi-Colon ”;”
One SQL Statement can Contain Only One Semo Colon.
* To Run the Previous OR Current SQL Statement in the Buffer Type “/” at SQL Prompt.
* To Open The SQL Editor Type “ED” at SQL Prompt.
8 .
How to Open SQL Server?
Goto -> Start -> All Programms -> Microsoft SQL Server 2008 R2 -> SQL Server management Studio.
9 .
What are SQL Injections? And How to Prevent SQL Injection Attacks?
It is a mechanism of getting secure data from the database.
SQL Injection Attacks:
* By providing proper validations for input fields.
* By using parameterized queries.
* By using stored procedures
* By using frequent code reviews
* We must not display database error messages in frontend
* An SQL injection is a code injection technique, used to attack data-driven applications.
10 .
What is Query & Query Language?
* A query is a statement requesting the retrieval of information. 

* The portion of dimly that involves information retrieval is called a query language.