SQL Database quickstart
Create your first SQL database in Azion Console or with the Azion API, add a table, insert a row, and read the row back.
This guide instructs you through storing and reading your first row in SQL Database. By the end you will have:
- Your first database, with the status
created. - A
userstable inside it. - One row stored in that table.
- The same row returned by a
SELECTstatement.
The result rests on two objects. The database is the container, and its name cannot be changed after creation. Each table lives inside one database, and this guide creates the table with a CREATE TABLE statement. A database is provisioned asynchronously. Its status reads creating first, and a statement runs against it only after the status reads created.
Select the interface you will use. The prerequisites and every stage below follow that choice.
Prerequisites
- SQL Database enabled on the account. The product is in Preview, and access is requested through the technical support team. To request it, refer to Technical Support.
- The Edit SQL Database permission on the account. It grants permission to create and edit databases and their data. For more information, refer to Teams Permissions.
- Access to Azion Console. To sign in, refer to How to access Azion Console.
Create a database
A database holds the tables you create. Its name is 6 to 50 characters, and uses letters, numbers, and the hyphen. Provisioning is asynchronous, so the database is not queryable the moment it is created.
To create the database in Azion Console:
Access Azion Console > SQL Database.
Start a new database from the list, with the SQL Database control.
Under General, in Name, enter a name of your own. A name another database in the account holds is refused.
The database appears in the list, which shows its Name, Status, Last Editor, and Last Modified. Its status reads creating until it reads created, which takes about 15 seconds.
Create a table
A table holds the rows you store, and its columns are fixed by the CREATE TABLE statement.
The Editor tab runs SQL against one database. To create the table this guide uses:
In the SQL Database list, select the database you created.
Create the users table with three columns:
The table appears under the Tables tab.
Insert a row
An INSERT statement stores a row in the table.
To store the first row from the Editor tab:
In the Editor tab, enter the following statement:
The table holds one row.
Read the row back
A SELECT statement returns what the table holds.
To read the row you inserted from the Editor tab:
In the Editor tab, enter the following statement:
The result carries one row under the columns id, name, and email: 1, Ada, and ada@example.com.
Your first database holds a users table with one row, and reads it back. The same statements run in Azion Console, through the Azion API, and inside a function.