SQL Interview Questions – Set 03

What is Full Join in SQL?

Full join return rows when there are matching rows in any one of the tables. This means it returns all the rows from the left-hand side table and all the rows from the right-hand side table.

What is the usage of the DISTINCT keyword?

The DISTINCT keyword is used to ensure that the fetched value is only a non-duplicate value. The DISTINCT keyword is used to SELECT DISTINCT, and it always fetches different (distinct) from the column of the table.

Write an SQL query to find names of employee start with ‘A’?

SELECT * FROM Employees WHERE EmpName like ‘A%’

What is Normalization in a Database?

Normalization is used to minimize redundancy and dependency by organizing fields and table of a database.

There are some rules of database normalization which commonly known as Normal From and they are:

  • First normal form(1NF)
  • Second normal form(2NF)
  • Third normal form(3NF)
  • Boyce-Codd normal form(BCNF)
    Using these steps, the redundancy, anomalies, inconsistency of the data in the database can be removed.

Which are the most commonly used SQL joins?

Most commonly used SQL joins are INNER JOIN and LEFT OUTER JOIN and RIGHT OUTER JOIN.

What is a Data Definition Language?

Data definition language (DDL) is the subset of the database which defines the data structure of the database in the initial stage when the database is about to be created. It consists of the following commands: CREATE, ALTER and DELETE database objects such as schema, tables, view, sequence, etc.

What are the types of operators available in SQL?

Operators are the special keywords or special characters reserved for performing particular operations and are used in the SQL queries. There is three type of operators used in SQL:

  • Arithmetic operators: addition (+), subtraction (-), multiplication (*), division (/), etc.
  • Logical operators: ALL, AND, ANY, ISNULL, EXISTS, BETWEEN, IN, LIKE, NOT, OR, UNIQUE.
  • Comparison operator: =, !=, <>, <, >, <=, >=, !<, !>

What is a unique key?

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

The Unique key cannot accept a duplicate value.

The unique key can accept only on Null value.

What is the Non-Clustered Index in SQL?

Non-Clustered Index:

The reason to create non-clustered index is searching the data. We well know that clustered indexes are created automatically primary keys are generated, but non-clustered indexes are created when multiple joins conditions and various filters are used in the query. Non-Clustered Index does not alter the physical order of the table and maintains logical order of data. Each table can have 999 non-clustered indexes.

Explain character-manipulation functions?

Character-manipulation functions are used to change, extract, alter the character string.

One or more than one characters and words should be passed into the function, and then the function will perform its operation on those words.