
For an instructor lead, in-depth look at learning SQL click below.
As we continue to advance in technology, even databases have made their transition to the cloud. Microsoft’s Azure SQL Database presents SQL Server’s capabilities in a fully managed Platform as a Service (PaaS). This reduces the burden of routine maintenance and adds automatic updates, scalability, and high resilience. Let’s explore Azure SQL Database with some examples:
Basic Operations in Azure SQL Database
Before we start, make sure you have set up your Azure account and created an Azure SQL Database. Now, just like any other SQL Server, we can perform operations using T-SQL queries.
Connect to Azure SQL Database
The first step is connecting to the database. You can use several tools like SQL Server Management Studio (SSMS), Azure Data Studio or even visual studio.
Select Query
Display records from a table using a SELECT statement. The syntax is identical to Microsoft SQL server. For example, to select all records from a table named EMPLOYEES:
|
1 2 3 |
SELECT * FROM EMPLOYEES |
Insert Query
To insert new records into a table, use the INSERT INTO statement. Suppose we are adding a new employee to the EMPLOYEES table:
|
1 2 3 4 |
INSERT INTO EMPLOYEES (EmployeeID, FirstName, LastName, Email) VALUES (1, 'John', 'Doe', <a href="mailto:'john.doe@example.com'" >'john.doe@example.com'</a>) |
Update Query
To modify records in a table, use the UPDATE statement. For example, if we need to update the email of John Doe:
|
1 2 3 4 5 |
UPDATE EMPLOYEES SET Email = <a href="mailto:'j.doe@example.com'" >'j.doe@example.com'</a> WHERE FirstName = 'John' AND LastName = 'Doe' |
Delete Query
To delete records from a table, use the DELETE statement. If we must delete John Doe’s record from the database:
|
1 2 3 4 |
DELETE FROM EMPLOYEES WHERE FirstName = 'John' AND LastName = 'Doe' |
Conclusion
Azure SQL Database brings the power of SQL Server to the cloud, making it easier for businesses to work with databases. It provides robustness, scalability and performance optimization capabilities with minimal administration needs. As far as modelling and querying data is concerned, T-SQL continues to serve as a reliable and flexible language.
Happy Coding!
