Interview questions and answers of SQL & .NET: Majority of IT company placement interviews are based on .NET programming and SQL databases. In dot NET era, VB.NET and C#.NET are to be used in windows application development meanwhile ASP.NET will be used in online apps development and website designing. At the same time SQL is used in database connectivity between front-end and back-end.
SQL interview questions & answers:
There are 20+ important SQL database interview questions with simple answers. SQL programming is usually query based methodology. There will be the queries for inserting, updating, displaying and deletion of database tables. Simply it is just like playing with back-end called database. Tables of contents will be stored in databases. Some of the sample SQL interview questions with their respective answers are:
Explain different type of SQL’s statements.
Different statements used in SQL can be classified as:
- DDL: It means Data Definition Language and this type of language is used to define the basic structure that is used to hold the data. For example, Drop and Truncate Table are used to drop the table or to erase it permanently.
- DML: The full form of DML is Data Manipulation language, and as the name suggests, it is used to perform the manipulation or changes to the data itself. The main operations linked to it are INSERT, UPDATE and DELETE.
- DCL: Data Control Language serves to control or restrict the visibility of essential data. It helps in setting database access and granting permissions to create tables etc. For example, Grant and Revoke, etc.
State the difference between the Unique Key and Primary Key?
Both the Unique and Primary keys are used to implement uniqueness to the column, where they are defined. The main difference is that when we use Primary key it generates a clustered index, and if we use unique key it generates the non-clustered index and this happens by default in both the cases. Also, Primary key doesn’t permit Nulls but in the case of Unique key one Null is allowed.
How do you define SQL Delete statement?
It is used to delete or erase a row or set of rows mentioned in the condition used to filter the data. The format of the SQL DELETE statement is:
DELETE FROM then table name and then the filter condition that indicates the rows to be updated.
State the function of UNION in SQL. Also, differentiate between UNION and UNION ALL.
UNION is used to combine the data of two tables that are structurally compatible. The main difference between UNION and UNION ALL is that in the case of UNION the duplicate records will get skipped but in the case of UNION ALL, they will be included in the resultant table.
What are the different types of JOIN clauses used in ANSI-standard SQL? Explain Them.
ANSI-standard SQL supports five different types of JOIN clauses, and they are:
- Simple JOIN or INNER JOIN: This clause returns all the rows in which at-least-one match is found in both the concerned tables. It’s the default JOIN, in case no other JOIN is specified.
- LEFT OUTER JOIN or simply LEFT JOIN: This clause returns the combination of the rows that are matched in the right table and all the rows from the left table. That means the result of using this clause will generate all the records from the left table whether there is a matching record found on the right table or not.
- RIGHT OUTER JOIN or RIGHT JOIN: As the name suggests it is just opposite to a LEFT JOIN. This type of JOIN statement returns all the rows that are there in Right Table plus the matched rows if any from the Left table.
- FULL OUTER JOIN or FULL JOIN: We may define it as the combination of LEFT JOIN and RIGHT JOIN. It returns all the rows that contain a match in any of the tables.
- CROSS JOIN: It results in all the records where each row from the Table no. 1 is combined or joined with each row from Table no.2. Or in other words, it generates the Cartesian product of the given sets of rows from the tables that are joined.
State the advantages and disadvantages of VIEWS in the database.
Starting with the Advantages of the VIEWS:
- The View is very useful when we need to hide few columns of the table, to give the restricted desired view of the table.
- The data does not get stored in the physical location while using a View.
- We can easily provide Access restrictions by using a View as the insertion, deletion and even updating the data is impossible with it.
Now, the Disadvantages of the VIEWS:
- In case of large tables, VIEWS occupy a large chunk of memory.
- A VIEW is created when a data asking query is triggered. This process is a bit slow and takes comparatively more time to generate results.
- In case we need to drop a table, the VIEW linked to it becomes irrelevant.
Give us SQL Query to find the Employee whose name starts with “K”.
SELECT * FROM employees WHERE EmpName like ‘K%’;
State the difference between TRUNCATE and DELETE commands in SQL?
In case of a DELETE, the data can be retrieved through COMMIT and ROLLBACK, but if we use TRUNCATE, the COMMIT and ROLLBACK statements or commands can’t be used to retrieve the data. Also, WHERE condition can be used while using the DELETE but it can’t be used along with TRUNCATE.
What is the significance of DROP command?
DROP command is used to drop the keys like Foreign Key or Primary Key from a table or sometimes to drop the Table itself.
.NET interview questions & answers:
There are 100+ important .NET interview questions with simple answers. This has complete important questions from VB.NET, C#.NET and ASP.NET. Freshers can learn all new things. Experienced persons can refresh their previous knowledge. But everyone including students will be finding this interview material is an useful guide. This .NET placement material is typically used in different kinds of technologies like windows application development or software development and website designing. Some of the sample questions are,
- Client side code and server side code,
- Inheritance in C#.NET and VB.NET,
- Various controls in .NET.
- XML mark-ups,
- Overloading,
- ASP.NET 2.0 applications,
- Multi-tasking,
- Boxing and unboxing,
- Using AJAX, Sessions and more.,
Guide: How to answer in toughest interview?
Download .NET & SQL interview questions:
This placement interview book is totally contains of more than 250 questions and answers. It is a free .NET & SQL placement interview. Downloadable link is given at the bottom of this page.
Download .NET & SQL interview QA