Duration: 16:18 min
Summary: In this video, we will continue the select statement discussion. We will start with the ‘use’ statement. We know that when we are writing SQL statements, we can be targeting many databases. So the question is: How can I make sure that my script is running against the right database? If we are lucky and we run the statement against the wrong database, we get an error message. But what happens if both databases have the same table name and you execute the script against the wrong database? No error message, just that what you intended. For this reason, the use statement comes to the rescue. We can put this statement at the top of the script to make sure that whenever we run the script we are ‘using’ the correct database. Then, we will see how to use the ‘order by’ clause to order our result set in ascending and descending order.
Technologies and Resources: T-SQL, SQL Server 2012 Express, AdventureWorks 2012, Database, Schema, Table, Select, From, Column, Row, where,Use, Order By, Year, Month, asc, desc.