3
1. What is SQL 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? A Relational Database Management System (RDBMS) is the most widely used database Management System based on the Relational Database model. Stores data in tables, Tables have rows and column, Creation and Retrieval of Table is allowed through SQL. 3. What is Data Mining? 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? 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? 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. Moreover, Primary Key doesn’t allow NULL value, however Unique Key does allows one NULL value. 6. How to store picture file in the database. What Object type is used? 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? 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? 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.

SQL Interview Qus

Embed Size (px)

DESCRIPTION

SQL Interview

Citation preview

Page 1: SQL Interview Qus

1. What is SQLSQL 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?A Relational Database Management System (RDBMS) is the most widely used database Management System based on the Relational Database model.Stores data in tables, Tables have rows and column, Creation and Retrieval of Table is allowed through SQL.

3. What is Data Mining?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?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?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. Moreover, Primary Key doesn’t allow NULL value, however Unique Key does allows one NULL value.

6. How to store picture file in the database. What Object type is used?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?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?Indexes are the quick references for fast data retrieval of data from a database. There are two different kinds of indexesClustered 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?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. What is Heap table?Tables that are present in the memory are called as HEAP tables. These tables are commonly known as memory tables. These memory tables never have values with data type like “BLOB” or “TEXT”. They use indexes which make them faster.

Page 2: SQL Interview Qus

11. What are DMVs?Dynamic management views (DMVs) and functions return server state information that can be used to monitor the health of a server instance, diagnose problems, and tune performance; that is, they let you see what is going on inside SQL Server. They were introduced in SQL Server 2005 as an alternative to system tables. One example is viewing operating system wait statistics via this query: SELECT * FROM sys.dm_os_wait_stats; Another example is examining current sessions, much like the sp_who2 command: SELECT * FROM sys.dm_exec_sessions;

12. What are temp tables? What is the difference between global and local temp tables? Temporary tables are temporary storage structures. You may use temporary tables as buckets to store data that you will manipulate before arriving at a final format. The hash (#) character is used to declare a temporary table as it is prepended to the table name. A single hash (#) specifies a local temporary table. CREATE TABLE #tempLocal ( nameid int, fname varchar(50), lname varchar(50) ) Local temporary tables are available to the current connection for the user, so they disappear when the user disconnects. Global temporary tables may be created with double hashes (##). These are available to all users via all connections, and they are deleted only when all connections are closed. CREATE TABLE ##tempGlobal ( nameid int, fname varchar(50), lname varchar(50) ) Once created, these tables are used just like permanent tables; they should be deleted when you are finished with them. Within SQL Server, temporary tables are stored in the Temporary Tables folder of the tempdb database.

13. How are transactions used?Transactions allow you to group SQL commands into a single unit. The transaction begins with a certain task and ends when all tasks within it are complete. The transaction completes successfully only if all commands within it complete successfully. The whole thing fails if one command fails. The BEGIN TRANSACTION, ROLLBACK TRANSACTION, and COMMIT TRANSACTION statements are used to work with transactions. A group of tasks starts with the begin statement. If any problems occur, the rollback command is executed to abort. If everything goes well, all commands are permanently executed via the commit statement.

14. What are DBCC commands? Basically, the Database Consistency Checker (DBCC) provides a set of commands (many of which are undocumented) to maintain databases—maintenance, validation, and status checks. The syntax is DBCC followed by the command name. Here are three examples: DBCC CHECKALLOC—Check disk allocation consistency. DBCC OPENTRAN—Display information about recent transactions. DBCC HELP—Display Help for DBCC commands.

15. What is a view? What is the WITH CHECK OPTION clause for a view?A view is a virtual table that consists of fields from one or more real tables. Views are often used to join multiple tables or to control access to the underlying tables. The WITH CHECK OPTION for

Page 3: SQL Interview Qus

a view prevents data modifications (to the data) that do not conform to the WHERE clause of the view definition. This allows data to be updated via the view, but only if it belongs in the view.

16.