This article will help you to create a new SQL database on Microsoft Azure. Along with that it will also help you in creating the tables in your database and add data to it.
1. After you login to your Azure account , click on “SQL Databases” on the left side of the screen as shown in the following screenshot.
2. In order to create a new database, you need to create a server. So click on “Create A SQL Database Server” option. You will be asked to enter a login name, a password and select the region .
3. After entering the details when you click on the “Right” option at the right corner of the screen, you will get a notification at the bottom of the screen as shown in the screenshot below.
4. Your server will be created in a few seconds. A server name will be randomly generated and the status of your server will be ”Started”. Now the next step is to create a database . So click on the server name to create a new database.
5. When you click on the Server name, you will see the server dashboard where you will see an option to “Create Database”. Click on that option.
6. A page will appear on the screen that will ask you for the details about your database, like name and the edition that you want to use. For the web edition you get a maximum size of 1 GB and for the business edition you get a maximum size of 10 GB.
7. After that you fill in all the details and click on the “Right” option at the right end corner of the page , you will see a notification at the bottom of the screen as shown in the screenshot below.
8. Within a few seconds the database will be created. Under the name section, you will see the name of the database that you filled in the details above for and the status will be “Online”
9. You have successfully created your first database on Azure. When you click on the database, it will take you to it's dashboard. On the dashboard you will get information regarding the connections (failed or successful) of database, how much data has been used and so on. Under the “Quick Glance” option you find the option “Show Connection Strings”. Click on that option.
10. The “Show Connection Strings” option gives you the connection string that you can use to connect to the database from various languages, like PHP, Java, ADO.NET and so on.
11. Now let's learn about how to create a table in your new database . Click on the “Manage” option that you see at the bottom of the screen. A new window will open that will ask you to enter the username and password. Your username will be the “username@servername” (here username is the name that you entered at the time of creating the server) and the “password” will be the password given at the time of creating the server.
12. After you click on the “Log in” option, you will get an error stating that you IP address is not added to the firewall.
13. So go to your server Dashboard, there you will get a notification at the bottom that will ask you to add that IP address to the firewall. Click on the “Yes” option. Then you will be asked “Do you want to manage the server now ”. Click the “Yes” option.
14. Another way to add an IP address to the firewall is to add it from the “Configure” option of your server. Click on “Add to Allowed IP address” and then click on the “Save” option.
15. Now again click on the “Manage” option and enter the login details. After successful login , you will see the screen shown in the screenshot below. Here you will get the details of your database(s) on that server.
16. Click on the “Administration” option and you will find there your created database. Now let's create a table in the database. There are the following two ways.
- Under the “Administration” option click on the “New Query” option and write the query to create the table.
- Click on the “Design” option and just provide the name of your table and columns and your table is created.
I will take the second option.
17. After you click on the “Design" option, you will see the screen as shown in the following screenshot . Enter the details, like provide the table name, provide the column names and click the “Save” option.
18 . You have successfully created a table and you can see it under the Tables option. Now to add data to the table you can click on the “tablename” and then click the “Edit ” option.
19. It will take you to the screen shown in the screenshot below . Here click on the “Data” option .
20. Now click on the “Add Row” option and enter the details . Then click on the “Save” option . You will able to add a new row to your table.
I hope this article was useful to you. Thank you for reading it.