What do you mean by Table Sample?
TABLE SAMPLE allows you to extract a sampling of
rows from a table in the FROM clause. The rows retrieved are random and they
are not in any order. This sampling can be based on a percentage of number of
rows. You can use TABLE SAMPLE when only a sampling of rows is necessary for
the application instead of a full result set.
What is Row_Number()?
ROW_NUMBER() returns a column as an expression that
contains the row’s number within the result set. This is only a number used in
the context of the result set, if the result changes, the ROW_NUMBER() will
change.
What are Ranking Functions?
Ranking functions return a ranking value for each
row in a partition. All the ranking functions are non-deterministic. Different
Ranking functions are:
ROW_NUMBER () OVER ([<partition_by_clause>]
<order_by_clause>)
Returns the sequential number of a row within a
partition of a result set, starting at 1 for the first row in each partition.
RANK () OVER ([<partition_by_clause>]
<order_by_clause>)
Returns the rank of each row within the partition
of a result set.
DENSE_RANK () OVER ([<partition_by_clause>]
<order_by_clause>)
Returns the rank of rows within the partition of a
result set, without any gaps in the ranking.
What is the difference between UNION
and UNION ALL?
UNION
The UNION command is used to select related information from two tables, much like the JOIN command. However, when using the UNION command all selected columns need to be of the same data type. With UNION, only distinct values are selected.
The UNION command is used to select related information from two tables, much like the JOIN command. However, when using the UNION command all selected columns need to be of the same data type. With UNION, only distinct values are selected.
UNION ALL
The UNION ALL command is equal to the UNION
command, except that UNION ALL selects all values. The difference between Union and Union all is that Union all will not eliminate duplicate rows, instead it
just pulls all rows from all tables fitting your query specifics and combines
them into a table.
What is B-Tree?
The database
server uses a B-tree structure to organize index information. B-Tree generally
has following types of index pages or nodes:
- root node: A root node contains node pointers
to branch nodes which can be only one.
- branch nodes: A branch node contains pointers
to leaf nodes or other branch nodes which can be two or more.
- leaf nodes: A leaf node contains index items and horizontal pointers to other leaf nodes which can be many.
0 comments
Post a Comment