Class 2 | Week 9 | DAT601
Today's lesson pertains to more SQL language beginning with the GROUP by clauses, little examples are being shown on the projector for us, these kind of physical examples are a lot easier to digest than writing on the whiteboard.
Group by must appear after the FROM and WHERE clauses, GROUP by groups rows into subgroups based on values of columns or expressions.
Todd's example is used to group columns together to show a sum of total sales for a specific region. Another example of a group by rollup which is described as a niche function which caused some debate in class as to what it actually does.
GROUP BY GROUPING SETS is used to allow multiple group-by clauses to operate in a single statement, GROUP BY GROUPING SETS is equivalent to the 'union' of two or more GROUP BY operation in the same result set.
Next topic is Views within SQL, which is used to present the information data in a different point of view. This can simplify the access to specific information within a database for viewing purposes only, we cant update a view and have it update the field it has aggregated from.
Backquotes and square brackets, allowing the database to use a name you devised without it being constrained to normal variable constraints.
Within SQL server some datatypes can not have a size defined for them, TINYINT being used as an example today that can have a size within MySQL but not with SQL server.
Group by must appear after the FROM and WHERE clauses, GROUP by groups rows into subgroups based on values of columns or expressions.
Todd's example is used to group columns together to show a sum of total sales for a specific region. Another example of a group by rollup which is described as a niche function which caused some debate in class as to what it actually does.
GROUP BY GROUPING SETS is used to allow multiple group-by clauses to operate in a single statement, GROUP BY GROUPING SETS is equivalent to the 'union' of two or more GROUP BY operation in the same result set.
Next topic is Views within SQL, which is used to present the information data in a different point of view. This can simplify the access to specific information within a database for viewing purposes only, we cant update a view and have it update the field it has aggregated from.
Backquotes and square brackets, allowing the database to use a name you devised without it being constrained to normal variable constraints.
Within SQL server some datatypes can not have a size defined for them, TINYINT being used as an example today that can have a size within MySQL but not with SQL server.
National character strings. A national character string is a sequence of bytes that represents character data in UTF-8 or UTF16BE encoding in a Unicode database. The length of the string is the number of code units in the sequence. If the length is zero, the value is called the empty string.
from - https://www.ibm.com/support/knowledgecenter/en/SS6NHC/...sql.ref.../r0057004.html
Next we have been tasked with an exercise to practice these tasks.
Comments
Post a Comment