Popular posts from this blog
COMMON TABLE EXPRESSIONS(cte): It is used best used to extract the hierarchical data and it is best explained with an example: Problem Many organizations have some type of hierarchy for business processes. When it comes to large organizations, the hierarchy can get very complex and large, so building a hierarchy in a RDBMS is a tedious task. We have to create views, cursors and so on, but using a CTE in SQL Server is a better solution to retrieve hierarchy-based data. Solution Common Table Expressions (CTE) have two types, recursive and non-recursive. We will see how the recursive CTE works with examples. A recursive CTE can be explained in three parts: Anchor Query: This is the first statement which is executed. This query will give the base data for the CTE. Separator: This is the middle part where in we generally use a UNION ALL and few more operators. Recursive Query: This is the main part, this is the CTE query which refers to the same CTE by recursion. ...
Table Relationships Before moving to the topic “Table Relationship”, we would have a look on the definition of Database, Table, Column and Row, as these entities participate in relationships. Database Database is an organized collection of data for fast processing on these data. These data are arranged in such form that enables fast retrieval of information and manipulation on these data. In RDBMSs, database organizes its data in relational form only using tables, column and rows. We can define relationships between these tables. Table A table is a collection of related data in a structured form using columns and rows within a database. It organizes its data using vertical columns and horizontal rows, intersection of a column and a row is known as a cell which stores the actual value in a table. Each column in a table has a unique name and no two columns of a table can have same name. A table have a defined number of columns with any number of rows. Rows can be ident...
Comments
Post a Comment