SQL Interview Questions
1 .
What is Deadlocking?
It is the situation where two transactions are waiting for other to release a lock on an item.
2 .
What is SQL Loader?
SQL Loader is a utility program which is used to transfer data from flat into oracle database. SQL Loader always executes control file based on the type of flat file we are creating control file and then submit control file to SQL loader then only SQL loader transfer file into flat file into oracle Data Base during this file some other files also created.
* Logfile
* Bad file
* Discard file
3 .
What is Row-Level-Attribute?
In this method, a single variable can represent all different datatype into a single unit. This variable is also called a record type variable.
Row Level Attribute is represented by using %rowtype.
variable_name table_name%rowtype;
4 .
What is Super Key?
A column or a combination of columns which uniquely identify a record in a table is called a Super Key.
5 .
What is Autoincrement?
In all databases generating primary key value automatically is called auto-increment concept. In Oracle, we are implementing the auto-increment concept by using row-level triggers, sequences. i.e here we creating sequence in SQL and use this sequence in PL/SQL row-level trigger.
SQL> create table test (sno number(10), primary key, name varchar2(10));
6 .
What is an Alias in SQL?
An alias is a feature of SQL that is supported by most, if not all, RDBMSs. It is a temporary name assigned to the table or table column for the purpose of a particular SQL query. In addition, aliasing can be employed as an obfuscation technique to secure the real names of database fields. A table alias is also called a correlation name .
An alias is represented explicitly by the AS keyword but in some cases the same can be performed without it as well. Nevertheless, using the AS keyword is always a good practice.
SELECT A.emp_name AS "Employee" 	/* Alias using AS keyword */
B.emp_name AS "Supervisor"
FROM employee A, employee B 		/* Alias without AS keyword */
WHERE A.emp_sup = B.emp_id;
7 .
What is Normalization?
Normalization represents the way of organizing structured data in the database efficiently. It includes creation of tables, establishing relationships between them, and defining rules for those relationships. Inconsistency and redundancy can be kept in check based on these rules, hence, adding flexibility to the database.
8 .
What is Denormalization?
Denormalization is the inverse process of normalization, where the normalized schema is converted into a schema which has redundant information. The performance is improved by using redundancy and keeping the redundant data consistent. The reason for performing denormalization is the overheads produced in query processor by an over-normalized structure.
9 .
What are the TRUNCATE, DELETE and DROP statements?
DELETE statement is used to delete rows from a table.
DELETE FROM Candidates
WHERE CandidateId > 1000;

TRUNCATE command is used to delete all the rows from the table and free the space containing the table.

DROP command is used to remove an object from the database. If you drop a table, all the rows in the table is deleted and the table structure is removed from the database.
DROP TABLE Candidates;
10 .
What is CLAUSE?
SQL clause is defined to limit the result set by providing condition to the query. This usually filters some rows from the whole set of records.
Example : Query that has WHERE condition
Query that has HAVING condition.