Thursday 25 September 2014

Sql interview Questions

Sql interview Questions

1. Define SQL?

Answer : SQL stands for Structured Query Language. SQL is a programming Language designed specially for managing data in Relational Database Management System (RDBMS).

2. What is RDBMS? Explain its features?

Answer :
  • A Relational Database Management System (RDBMS) is the most widely used database Management System based on the Relational Database model.
   Features of RDBMS
  • Stores data in tables.
  • Tables have rows and column.
  • Creation and Retrieval of Table is allowed through SQL.

3. What is Data Mining?

Answer : Data Mining is a subcategory of Computer Science which aims at extraction of information from set of data and transform it into Human Readable structure, to be used later.

4. What is an ERD?

Answer : ERD stands for Entity Relationship Diagram. Entity Relationship Diagram is the graphical representation of tables, with the relationship between them.

5. What is the difference between Primary Key and Unique Key?

Answer : 
Both Primary and Unique Key is implemented for Uniqueness of the column. Primary Key creates a clustered index of column where as an Unique creates unclustered index of column.

Primary key doesn't allow null and doesn't allow duplicates
Unique key will allow one null and doesn't allow duplicates.

6. How to store picture file in the database. What Object type is used?

Answer : Storing Pictures in a database is a bad idea. To store picture in a database Object Type ‘Blob’ is recommended.

7. What is Data Warehousing?

Answer : A Data Warehousing generally refereed as Enterprise Data Warehousing is a central Data repository, created using different Data Sources.

8. What are indexes in a Database. What are the types of indexes?

Answer : 
  • Indexes are the quick references for fast data retrieval of data from a database. There are two different kinds of indexes.
  Clustered Index
  • Only one per table.
  • Faster to read than non clustered as data is physically stored in index order.
  Non­clustered Index
  • Can be used many times per table.
  • Quicker for insert and update operations than a clustered index.

9. How many TRIGGERS are possible in MySql?

Answer : There are only six triggers are allowed to use in MySQL database and they are.
  • Before Insert
  • After Insert
  • Before Update
  • After Update
  • Before Delete
  • After Delete

10. Differentiate between FLOAT and DOUBLE.

FLOAT stores floating point numbers with accuracy up to eight places and has four bytes while DOUBLE stores floating point numbers with accuracy upto 18 places and has eight bytes.

11. What are the advantages of MySQL in comparison to Oracle?

  • MySQL is open source software available at zero cost. 
  • It is portable 
  • GUI with command prompt.
  • Administration is supported by MySQL Query Browser

12. What is BLOB?

  • BLOB stands for binary large object. 
  • It that can hold a variable amount of data. 
There are four types of BLOB based on the maximum length of values they can hold:
  • TINYBLOB
  • BLOB
  • MEDIUMBLOB 
  • LONGBLOB

13. What is TEXT?

TEXT is case-insensitive BLOB. The four types of TEXT are:

  • TINYTEXT
  • TEXT
  • MEDIUMTEXT
  • LONGTEXT

14. What is the difference between BLOB and TEXT?

  • In BLOB sorting and comparison is performed in case-sensitive for BLOB values 
  • In TEXT types sorting and comparison is performed case-insensitive.

15. How would concatenate strings in MySQL?

With the use of - CONCAT (string1, string2, string3)

16. How would you get the current date in Mysql?

By using SELECT CURRENT_DATE();

17. How would you enter Characters as HEX Numbers?

  • To enter characters as HEX numbers, you can enter HEX numbers with single quotes and a prefix of (X)
  • Alternatively, just prefix HEX numbers with (Ox).

18. How are MySQL timestamps shown to a user?

  • MySQL time stamps are shown to a user in a readable format : YYYY-MM-DD HH:MM:SS.

No comments: