- When returning a record set of data,…SQL Server will return the records in the order…which they are put into the database,…unless we instruct it to do otherwise.…Using the ORDER BY clause, we can have the table…sort in any way we want.…Let's go ahead and test this out in a new query.…I'm going to start a query that selects everything…from the Customers table.…Then, I'm going to interjoin this to the Invoices table.…Next I'll specify where that join occurs,…in this case it's on the CustomerID in both tables.…And if I run this query right now,…you'll see that it's in kind of a random order here.…

Let's go ahead and add one more line.…I'm going to add in the line ORDER BY,…and then I'm going to specify CustomerID.…Let's Execute this again,…and it looks like I have an error here.…It says Ambiguous Column Name "CustomerID".…I need to be a little bit more specific,…that I mean the Customers.CustomerID,…not the Invoices.CustomerID.…So I'm going to go back here in the beginning and type in…Customers.CustomerID to be specific.…

Resume Transcript Auto-Scroll

Author

Released

8/20/2015

Brand new to database administration? Take it one step at a time with Database Fundamentals, a series designed to support a new career or lifelong journey in IT. This installment is devoted to data: getting it into and out of tables and databases. Adam Wilbert shows how to get the most out of each data type, including numbers, characters, and specialized types like spatial data. Next are queries. Learn how to write commands and invoke functions in the SQL Editor to select just the records you want. Finally, get comfortable inserting, updating, and deleting data with the SQL Server Management Studio (SSMS), a suite of graphical tools and rich editors that make working with databases much more intuitive. Do you want to test your knowledge? Watch the challenge videos to practice what you've learned along the way.