SHASHANGKA SHEKHAR'S BLOG

Author, TechWriter

What are types of sub-queries?

Hits: 18

  1. Single-row subquery, where the subquery returns only one row.
  2. Multiple-row subquery, where the subquery returns multiple rows and
  3. Multiple column subquery, where the subquery returns multiple columns.

What is sub-query? Explain properties of sub-query.

Hits: 56

Sub-queries are often referred to as sub-selects, as they allow a SELECT statement to be executed arbitrarily within the body of another SQL statement. A sub-query is executed by enclosing it in a set of parentheses. Sub-queries are generally used to return a single row as an atomic value, though they may be used to compare values against multiple rows with the IN keyword. Read More

What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?

Hits: 23

Specifies a search condition for a group or an aggregate.

  1. HAVING can be used only with the SELECT statement.
  2. HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause.
  3. Having Clause is basically used only with the GROUP BY function in a query.
  4. WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.
  5. HAVING criteria is applied after the the grouping of rows has occurred.

What types of Joins are possible with Sql Server?

Hits: 20

Joins are used in queries to explain how different tables are related. Joins also let you select data from a table depending upon data from another table.
Types of joins: INNER JOINs, OUTER JOINs, CROSS JOINs. OUTER JOINs are further classified as LEFT OUTER JOINS, RIGHT OUTER JOINS and FULL OUTER JOINS.

Difference between Function and Stored Procedure?

Hits: 26

User-Defined Functions(UDF) can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section

where as Stored procedures cannot be.
UDFs that return tables can be treated as another rowset. This can be used in JOINs with other tables.
Inline UDF’s can be though of as views that take parameters and can be used in JOINs and other Rowset operations.

Pages:1...22232425262728...34