Suppose there is a table named countrytable. Here * displays all the columns of the countrytable (In our case, there are four columns viz SerialNo, Country, Continent, DensityPerKmSq). There is no condition in the query. Hence all the rows of the countrytable are fetched(In our case, there are twelve rows).
Note: The single smallest unit in a table is called cell. For example "9" is in a cell,"Germany" is in another cell,etc. The intersection of a row and a column is a cell. For example "9" is in 9th row 1st column. "Germany" is in 9th row 2nd column,etc.
If a cell has NULL, it means the content of the cell is an unknown value. The value of a cell having NULL is different from ZERO, may or may not be space, is not an empty value, it can be any thing.
Two NULL values may or may not be equal.
Let there be another table named citytable.The contents of the table are below.
As you could see the single horizontal values constitute a row and a single vertical values constitute a column. The values are ordered by Continent in ascending order(Default is ascending order) and Country in descending order as the keyword "desc" is given for Country column. If there is a tie in continent values, then rows are ordered by country as shown in descending order.For example there is America continent four times. So the next consideration is that the values are ordered by Country in descending order i.e first USA and then Brazil.In order by clause, first comes continent and then comes country.So first preference in ordering is given to continent and then to country.
Let there be another table named Mayor table.The mayors of cities should be checked again with this table. The contents of the table is below.
Important Note : All the queries are compatible with MS-SQL SERVER 2008
If a cell has NULL, it means the content of the cell is an unknown value. The value of a cell having NULL is different from ZERO, may or may not be space, is not an empty value, it can be any thing.
Two NULL values may or may not be equal.
Let there be another table named citytable.The contents of the table are below.
As you could see the single horizontal values constitute a row and a single vertical values constitute a column. The values are ordered by Continent in ascending order(Default is ascending order) and Country in descending order as the keyword "desc" is given for Country column. If there is a tie in continent values, then rows are ordered by country as shown in descending order.For example there is America continent four times. So the next consideration is that the values are ordered by Country in descending order i.e first USA and then Brazil.In order by clause, first comes continent and then comes country.So first preference in ordering is given to continent and then to country.
Let there be another table named Mayor table.The mayors of cities should be checked again with this table. The contents of the table is below.
Important Note : All the queries are compatible with MS-SQL SERVER 2008
No comments:
Post a Comment