Congratulations! You got the interview! In this SQL Server Developer Interview Questions post, we have put together both basic and advanced SQL Interview Questions and Answers. This post contains Top SQL Interview Questions for Experienced as well as Freshers.
Basic & Advanced SQL Interview Questions And Answers:
I have segregated this âSQL Server Interview Questionsâ post into two types.
1. Common SQL Interview Questions
2. Practical SQL Query Interview Questions (SQL Server Queries examples with answers).
I donât want to take much time of yours but I couldnât move further without mentioning about this inevitable job interview question which every hiring manager asks you in any interview i.e., Tell Me About Yourself. Answering these questions is very easy if you follow the link. It contains sample answers for both freshers and experienced. Now, Letâs move on to the actual post.
General SQL Interview Questions:
Ten Tough Interview Questions and Ten Great Answers Mental fear of the unknown is often what produces the physical symptoms of nervousness. In addition to preparing yourself physically, you need to prepare yourself mentally.
1. What is a Database?
A database is a collection of information in an organized form for faster and better access, storage and manipulation. It can also be defined as a collection of tables, schema, views, and other database objects.
2. What is Data warehouse?
Data warehouse refers to a central repository of data from multiple sources of information. Those data are consolidated, transformed and made available for the mining as well as online processing.
3. What is a Table in a Database?
A table is a database object used to store records in a field in the form of columns and rows that holds data.
4. What is a Field in a Database?
A field in a Database table is a space allocated to store a particular record within a table.
5. What is a Record in a Database?
A record (also called a row of data) is an ordered set of related data in a table.
6. What is a column in a Table?
A column is a vertical entity in a table that contains all information associated with a specific field in a table.
7. What is DBMS?
Database Management System is a collection of programs that enables a user to store, retrieve, update and delete information from a database.
8. What are the types of DBMS?
There are two types of DBMS 1. Relational Database Management System (RDBMS) 2. Non-Relational Database Management System
9. What is RDBMS?
RDBMS stands for Relational Database Management System. RDBMS is a database management system (DBMS) that is based on the relational model. Data from a relational database can be accessed using Structured Query Language (SQL)
10. What are the popular Database Management Systems in the IT Industry?
Oracle, MySQL, Microsoft SQL Server, PostgreSQL, Sybase, MongoDB, DB2, and Microsoft Access etc.,
11. What is SQL?
SQL Overview: SQL stands for Structured Query Language. It is an American National Standard Institute (ANSI) standard. It is a standard language for accessing and manipulating databases. Using SQL, some of the action we could do are to create databases, tables, stored procedures (SPâs), execute queries, retrieve, insert, update, delete data against a database.
12. What are the different types of SQL commands?
SQL commands are segregated into the following types:
13. What are the different DDL commands in SQL?
DDL commands are used to define or alter the structure of the database.
14. What are the different DML commands in SQL?
DML commands are used for managing data present in the database.
15. What are the different DCL commands in SQL?
DCL commands are used to create roles, grant permission and control access to the database objects.
16. What are the different TCL commands in SQL?
TCL commands are used to manage the changes made by DML statements.
17. What is an Index?
An index is used to speed up the performance of queries. It makes faster retrieval of data from the table. The index can be created on one column or a group of columns.
18. What are all the different types of indexes?
There are three types of indexes 1. Unique Index: Unique Indexes helps maintain data integrity by ensuring that no two rows of data in a table have identical key values. A unique index can be applied automatically when a primary key is defined. It ensures that the values in the index key columns are unique. 2. Clustered Index: Clustered Index reorders the physical order of the table and search based on the key values. There will be only one clustered index per table. 3. Non-Clustered Index: Non-Clustered Index doesnât alter the physical order of the table and maintains a logical order of the data. Each table can have many non-clustered indexes.
19. What is the difference between Cluster and Non-Cluster Index?
The difference between the clustered and non-clustered index in SQL is as follows: Clustered Index: It is used for easy retrieval of data from the database and it is faster. One table can only have one clustered index It alters the way records are stored in a database as it sorts out rows by the column which is set to be clustered index. Non-Clustered Index: It is slower compared to the Clustered index. One table can have multiple non clustered index It doesnât alter the way it was sorted but it creates a separate object within a table which points back to the original table rows after searching.
20. What is a View?
A view is like a subset of a table which is stored logically in a database. A view is a virtual table. It contains rows and columns similar to a real table. The fields in the view are fields from one or more real tables. Views do not contain data of their own. They are used to restrict access to the database or to hide data complexity.
E.g. âAgeâ field should contain only the value greater than 18.
60. Which TCP/IP port does SQL Server run?
By default, it is 1433
61. List out the ACID properties and explain?
Following are the four properties of ACID. These guarantees that the database transactions are processed reliably.
62. Define the SELECT INTO statement.
The SELECT INTO statement copies data from one table into a new table. The new table will be created with the column-names and types as defined in the old table. You can create new column names using the AS clause.
Output:
Interview Questions And Answers Pdf For System Administrator
94. How to select all the even number records from a table?
To select all the even number records from a table:
95. How to select all the odd number records from a table?
To select all the odd number records from a table:
96. What is the SQL CASE statement?
SQL Case statement allows embedding an if-else like clause in the SELECT statement.
97. Can you display the result from the below table TestTable based on the criteria M,m as M and F, f as F and Null as N and g, k, I as U
98. What will be the result of the query below?
This query returns âFalseâ. In the above question, we could see null = null is not the proper way to compare a null value. To compare a value with null, we use IS operator in SQL.
So the correct way is as follows
99. What will be the result of the query below?
This query will returns âQueries In SQL Serverâ.
Safety Officer Interview Questions And Answers Pdf
100. How do you update F as M and M as F from the below table TestTable?
101. Describe SQL comments?
Single Line Comments: Single line comments start with two consecutive hyphens (â) and ended by the end of the line Multi-Line Comments: Multi-line comments start with /* and end with */. Any text between /* and */ will be ignored.
102. What is the difference between NVL function, IFNULL function, and ISNULL function?
These three functions work in the same way. These functions are used to replace NULL value with another value. Oracle developers use NVL function, MySQL developers use IFNULL function and SQL Server developers use ISNULL function. Assume, some of the values in a column are NULL. If you run below statement, you will get result as NULL
Suppose any of the value in col3 is NULL then as I said your result will be NULL.
To overcome this we use NVL() function, IFNULL() function, ISNULL() Function.
ORACLE:
MySQL:
Also, you can use the COALESCE() function
Also Read:
SUBSCRIBE TO GET FREE EBOOK AND REGULAR UPDATES ON SOFTWARE TESTINGComments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |