Library Technology - Reviews, Tips, Giveaways, Freeware

Library Technology – Reviews, Tips, Giveaways, Freeware

Top 25 SQL Interview Questions & Answers

Posted In Online services, Backup - Recover - By Techtiplib on Thursday, March 23rd, 2017 With No Comments »

SQL is a language for accessing and manipulating database standardized by ANSI. To be successful with database-centric applications (which includes most of the applications Data Warehousing domain), one must be strong enough in SQL. Bringing an SQL Certification to the table gives you an edge for jobs. In this article, we will learn about SQL in the form of many question-answer sessions commonly asked in Interviews.

SQL server

  1. What is the difference between SQL and PL/SQL?

PL/SQL is a dialect of SQL that adds procedural features of programming in SQL. It was developed by Oracle Corporation in the early 90’s to enhance the capabilities of SQL.

  1. When SQL appeared?

It appeared in 1974.

  1. Does SQL support programming?

No, SQL doesn’t have Conditional statement or loop. It is used like commanding language to access databases.

  1. What is a primary key?

A primary key is an aggregate of fields which uniquely specify a row. This is a special kind of unique key. Primary key values cannot be NULL.

  1. What are the type of operators available in SQL?

Arithmetic operators, Logical operators, Comparison operator

  1. What is an Index in SQL?

Index is used to increase the performance and allow faster retrieval of records from the table. An index creates an entry for each value and it will be faster to retrieve data.

  1. What is the SQL query to display current date?

There is a built in function in SQL called GetDate() which is used to return current timestamp.

  1. Can you sort a column using a column alias?

Yes. A column alias could be used in the ORDER BY clause.

  1. What is the purpose of the condition operators BETWEEN and IN?

The operator BETWEEN shows rows based on a range of values and IN condition operator checks for values contained in a specific set of values.

  1. What is the main purpose of the NVL function?

The NVL function change a NULL value to an actual value.

  1. What is a unique key?

A Unique key constraint uniquely identifies each record in the database. This provides uniqueness for the column or set of columns.

  1. Which are the most commonly used SQL joins?

One of the most commonly used SQL joins are INNER JOIN and (left/right) OUTER JOIN.

  1. What is Inner Join in SQL?

Inner join returns rows when there is at least one match of rows between the tables.

  1. What is self join and what is the requirement of self join?

Self join is often so useful to change a hierarchical structure to a flat structure. It is used to join a table to itself.

  1. What are set operators in SQL?

Union, Intersect or Minus operators are called set operators.

  1. Which statement is used to add a new row in a database table?

The INSERT INTO statement.

  1. How do you copy rows from one table to another?

The INSERT statement can be used to add rows to a table by replicating from another table. For this situation, a subquery is used in the place of the VALUES clause.

  1. What happens if you omit the WHERE clause in the UPDATE statement?

All the rows in the table are modified.

  1. What is the default ordering of data using the ORDER BY clause?

The default sorting order is ascending. It can be changed using the DESC keyword, after the column name in the ORDER BY clause.

  1. What are the case manipulation functions of SQL?

LOWER, UPPER, INITCAP

  1. Which function returns the remainder in a division operation?

The MOD function returns the remainder in a division operation.

  1. What is the usage of NVL function?

The NVL function is used to convert NULL value to a actual value.

  1. What do you mean by Cross Join?

The term cross join will return all records where each row from the first table is consolidated with each row from the second table.

  1. What are the main uses of SQL functions?

Performing calculations on data, manipulating the output, formatting dates and numbers, modifying data individual items, and converting data types.

  1. What is the use of the NULLIF function?

NULLIF function compares two expressions. If they are not equal, the first expression is returned, If they are equal, the function returns null.

Author Bio:

The Michael Warne is a SQL certified professional with more than 5 years of experience in the industry. The author has imparted SQL Server Certification Training, to working professionals and has been proactively talking about the importance of this course.

More contents in: ,

About - Hey, this blog belongs to me! I am the founder of TechTipLib and managing editor right now. And I love to hear what do you think about this article, leave comment below! Thank you so much...