Oracle Database Interview Questions & Answers Set-13

«« Previous
Next »»

1. What is SQL?
Ans: SQL stands for structured query language. It is a database language used for database creation, deletion, fetching rows and modifying rows etc. sometimes it is pronounced as se-qwell.


2. When SQL appeared?
Ans: It appeared in 1974.


3. What are the usages of SQL?
Ans: 
  • To execute queries against a database
  • To retrieve data from a database
  • To inserts records in a database
  • To updates records in a database
  • To delete records from a database
  • To create new databases
  • To create new tables in a database
  • To create views in a database

4. Does SQL support programming?
Ans: No, SQL doesn't have loop or Conditional statement. It is used like commanding language to access databases.


5. What are the subsets of SQL?
Ans:
  1. Data definition language (DDL)
  2. Data manipulation language (DML)
  3. Data control language (DCL)

6. What is data definition language?
Ans: Data definition language(DDL) allows you to CREATE, ALTER and DELETE database objects such as schema, tables, view, sequence etc.


7. What is data manipulation language?
Ans:
Data manipulation language makes user able to access and manipulate data. It is used to perform following operations.
  • Insert data into database
  • Retrieve data from the database
  • Update data in the database
  • Delete data from the database

8. What is data control language?
Ans: Data control language allows you to control access to the database. It includes two commands GRANT and REVOKE.

GRANT: to grant specific user to perform specific task.
REVOKE: to cancel previously denied or granted permissions.


9. What are the type of operators available in SQL?
Ans: 
  1. Arithmetic operators
  2. Logical operators
  3. Comparison operator

10. What is the difference between clustered and non clustered index in SQL?
Ans: There are mainly two type of indexes in SQL, Clustered index and non clustered index. The differences between these two indexes is very important from SQL performance perspective.

1) One table can have only one clustered index but it can have many non clustered index. (approximately 250).

2) clustered index determines how data is stored physically in table. Actually clustered index stores data in cluster, related data is stored together so it makes simple to retrieve data.

3) reading from a clustered index is much faster than reading from non clustered index from the same table.

4) clustered index sort and store data rows in the table or view based on their key value, while non cluster have a structure separate from the data row.


11. What is the SQL query to display current date?
Ans: There is a built in function in SQL called GetDate() which is used to return current timestamp.


12. Which types of join is used in SQL widely?
Ans: The knowledge of JOIN is very necessary for an interviewee. Mostly used join is INNER JOIN and (left/right) OUTER JOIN.


13. What is "TRIGGER" in SQL?
Ans: Trigger allows you to execute a batch of SQL code when an insert, update or delete command is executed against a specific table.

Actually triggers are special type of stored procedures that are defined to execute automatically in place or after data modifications.


14. What is self join and what is the requirement of self join?
Ans: Self join is often very useful to convert a hierarchical structure to a flat structure. It is used to join a table to itself as like if that is the second table.


15. What are set operators in SQL?
Ans: Union, intersect or minus operators are called set operators.

«« Previous
Next »»