Get instructions for how to use the exercise fikes, including how to check the SSMS (SQL Server Management Studio) connection to the Azure SQL database.
- [Instructor] If you have access to the exercise files for this course you can download them to your desktop. However, first follow along with the course to create your Azure SQL database. From the Azure portal click on the first icon, the three horizontal lines, expand the menu option and then select SQL Databases. If you don't see SQL Databases, click on More Services and scroll down. Once you click on SQL Databases you will see your new database as created in the first section of the course, click on the database name, and then you will see the server name at the top right.
Click the click to copy button, and it will say copied once the text is copied to your clipboard. Install SQL Sever Management Studio, and then download the exercise files to your local machine. Once downloaded you have to extract the exercise files by right clicking the zip file, and selecting Extract All. You can pick any name for the folder.
And in that new folder you will find the SQL Server Management Studio Solution. Double click the Solution to open the Solution file in SQL Server Management Studio. Once you have SQL Server Management Studio open and your project has been loaded, you will notice there is all of the queries as shown in the course, and you can follow along by opening each file in turn. When you open the file it will use a connection to SQL Server on Azure.
You need to ensure that it is your SQL Server. You'll not be able to connect to mine, so you can remove the SQL Server from this connection, and then when you double click or open your file, like in this example, Create Table, double click to open the file, and it will prompt you for your SQL Server details. Control V to paste the name of the server that we have copied from the Azure portal, and then under Authentication select SQL Server Authentication. You'll have to enter your username and password, and remember as per the course instructions, you'll have to do a username and password when you create the database, and you would have to add your own IP address to the firewall of Azure SQL to allow you access from this client machine.
The SQL Server Management Studio connection window will show you an error in both cases specifically saying to add your firewall rule or to update your credentials. Once you have your credentials entered you'll be able to connect to the database server. Click inside the window where the text is, and notice at the top left corner the current database selected for your query.
You see it currently says Master, and that is not correct. We want to use the database we have just created. We want to connect to the Learning database. As per the first part of the course, when you create your database you may choose a different name, and thus you need to make sure you select the correct name for the database you wish to use. The Learning database is the one we use throughout the course, so every time you open a file just check in the top left corner is Learning the current database for executing your query? If ever it looks like you lost a table or that you cannot find a table that you wish to work with it might just be that the current selected database is not the one you intend.
As you follow along with the rest of the course we will use the new database we've created. You also have the option to create an additional database if you want more data and more complex tables. So, for an additional challenge you may go back to the portal, click on the horizontal three line icon, click on SQL Servers, and click on your SQL Server. What we will do is create a new database but in this case a database with a sample data, so instead of the empty database we've created before, we will add a database which will show up in the same database server but this time with sample data.
click on the green plus sign, click on Databases, and click on SQL Database. In this case, we will call the database Sample. We will keep the defaults, including the resource group but instead of picking Blank database we will pick Sample, which is the AdventureWorks database sample from Microsoft. We can use the same server, and we can choose the bottom pricing tier. Apply the basic tier and click Create.
Again, you can click on SQL Servers. It will show your server. Click on your server's name, and then you'll see as before the Learning database shows up in the list of databases, and below that the new Sample database will show up, once it has been created. If you don't have access to the exercise files, that is okay. You can create your own exercise files, and just type the scripts and queries as you follow along the course, and I encourage you to follow along and use either the empty database or the new Sample database to explore queries further and write your own examples.
Best of luck.
- Creating a new Azure SQL database
- Using basic SQL statements such as SELECT and INSERT
- Using SQL statements to update, modify, and delete data
- Adding functions to your SELECT statement to modify how numbers are displayed
- Filtering and formatting results
- Saving and sharing your work by creating views
- Sharing access to your database with other users