Republic Day Sale: Get Upto 35% OFF on Live Training! Offer Ending in
D
H
M
S
Get Now
What is the Azure SQL database? A Complete Guide

What is the Azure SQL database? A Complete Guide

21 Jan 2025
Advanced
49 Views
33 min read
Learn with an interactive course and practical hands-on labs

Free Azure Online Course with Certificate [For Beginners]

Azure SQl Database

Azure SQL Database is a fully managed cloud service that simplifies data management for businesses. With Azure SQL Database, you can quickly scale resources and ensure high performance while benefiting from robust security features. Ideal for both new applications and migrations, the Azure SQL Database offers the flexibility and reliability organizations need in today’s digital landscape.

In this Azure Tutorial, let's explore Azure SQL Database, Features of Azure SQL Database, Why should You use Azure SQL Database?, Azure SQL Database Architecture, Querying using Azure SQL Database, Guide to Creating Azure SQL Database, Pricing for Azure SQL DatabaseDeleting Database in Azure SQLand a lot more.

What is Azure SQL Database?

Azure SQL Database is a cloud-based service from Microsoft that simplifies data management for businesses. With Azure SQL Database, you benefit from features like automatic backups and scaling, allowing you to focus on your applications. Whether you're accessing data from anywhere or ensuring security, Azure SQL Database has you covered.

Let's go through some essential points for Azure SQL Database:

  • Azure SQL Database handles backups and updates, letting you focus on your applications.
  • You can easily scale Azure SQL Database resources up or down based on your needs.
  • Azure SQL Database includes encryption and threat detection to keep your data safe.
  • With a 99.99% uptime guarantee, the Azure SQL Database ensures your applications stay online.
  • Azure SQL Database connects easily with other Azure services like Power BI and Azure Functions.

Features of Azure SQL Database

Here are some key features of Azure SQL Database:

  • Automatic Backups: Your data is automatically backed up, so you can easily restore it if something goes wrong. You don’t have to worry about losing important information.
  • Built-in Intelligence: Azure SQL Database analyzes your performance and suggests improvements, helping your applications run more smoothly without extra effort on your part.
  • Scalability: You can quickly adjust the size of your database to handle more or less traffic, ensuring you only pay for what you need.
  • Strong Security: With features like encryption and threat detection, Azure SQL Database keeps your data safe from unauthorized access.
  • High Availability: Azure SQL Database is designed to be up and running most of the time, so your applications stay accessible without interruptions.
  • Easy Integration: It works well with other Azure services, making it simple to add new features and capabilities to your applications.

Why should You use Azure SQL Database?

Here are some simple reasons why you should consider using Azure SQL Database:

  • Easy Management: The Azure SQL Database takes care of routine tasks like backups and updates, so you don’t have to worry about maintenance.
  • Flexible Scaling: You can quickly adjust the resources of Azure SQL Database to match your workload, ensuring you only pay for what you need.
  • Strong Security: With features like encryption and threat detection, Azure SQL Database helps keep your data safe from potential threats.
  • High Availability: Azure SQL Database offers a reliable uptime guarantee, meaning your applications can run smoothly without interruptions.
  • Integration with Azure Services: It works well with other Azure tools, making it easy to enhance your applications with additional features and capabilities.
  • Cost-Effective: The Azure SQL Database provides various pricing options, allowing you to choose a plan that fits your budget and performance needs.
  • Global Reach: With data centers around the world, Azure SQL Database can help reduce latency by placing your data closer to your users.

Azure SQL Database Architecture

Azure SQL Database architecture consists of four main layers, each playing a crucial role in how the service operates:

  1. Client Layer
  2. Service Layer
  3. Platform Layer
  4. Intrascture Layer

Azure SQL Database Architecture

1. Client Layer

This is where users and applications interact with Azure SQL Database. It includes web, mobile, and desktop apps that send requests to the database, making it easy for developers to access and manipulate data.

2. Service Layer

Acting as a bridge between the client and infrastructure, the service layer manages database services like query processing and security. It ensures efficient handling of requests and provides features like automatic scaling to maintain performance.

3. Platform Layer

This layer includes the core database engine and tools that power Azure SQL Database. It executes queries, manages data structures, and ensures data integrity while offering built-in intelligence for performance optimization.

4. Infrastructure Layer

The foundation of Azure SQL Database, this layer consists of the physical and virtual resources, such as servers and storage systems. It ensures high availability and disaster recovery, providing the reliability needed for smooth application operation.

Difference Between Azure SQL and SQL Server

Here’s a comparison between Azure SQL Database and SQL Server:

FeaturesAzure SQL DatabaseSQL Server
DeploymentCloud-based service managed by Microsoft.On-premises or self-hosted in your own environment.
ManagementFully managed service with automatic updates and backups.Requires manual management, including updates and backups.
ScalabilityEasily scalable with dynamic resource allocation.Scaling often requires hardware upgrades and can involve downtime.
Cost ModelPay-as-you-go pricing based on usage.Typically, it involves upfront licensing costs and ongoing maintenance expenses.
High AvailabilityBuilt-in high availability with a 99.99% SLA.High availability must be configured and managed manually.
SecurityAdvanced security features like threat detection and encryption are built-in.Security features are available but require manual setup and management.
IntegrationSeamless integration with other Azure services.Integration with cloud services is possible but may require additional configuration.

Azure SQL Database Tiers

Let's understand the Azure SQL Database Tiers:

1. Basic Tier

  • This tier is great for small applications or testing.
  • It has limited resources, making it affordable for light workloads.
  • It’s perfect if you don’t need a lot of performance or storage.

2. Standard Tier

  • This tier is designed for medium-sized applications that need more power.
  • It offers a good balance between cost and performance.
  • You get features like automatic backups and the ability to restore your database easily.
  • It’s a solid choice for business applications that need reliable performance.

3. Premium Tier

  • This tier is for high-performance applications that require a lot of resources.
  • It provides faster response times and lower delays.
  • You also get advanced features like better security and higher availability.
  • It’s ideal for mission-critical applications that can’t afford downtime.

4. Hyperscale Tier

  • This tier is designed for very large databases that need to grow quickly.
  • It allows you to scale your storage and computing power easily.
  • You can also create read replicas and back up your data quickly.
  • It’s perfect for big applications and data analysis.

5. Serverless Tier

  • This tier automatically pauses when not in use, which helps save money.
  • You only pay for the resources you use when the database is active.
  • It scales automatically based on your needs, making it great for applications with changing workloads.

Azure SQL Database Deployment Models

Azure SQL Database offers several deployment models to cater to different application needs and scenarios. Here’s a breakdown of the main deployment models:

1. Single Database

  • This model allows you to create a standalone database in Azure.
  • It’s ideal for applications that require a dedicated database with its own resources.
  • You can easily scale it up or down based on your needs, and it includes features like automatic backups and high availability.

2. Elastic Pool

  • An elastic pool is a collection of databases that share resources like CPU and memory.
  • This model is great for applications with multiple databases that have varying usage patterns.
  • By pooling resources, you can optimize costs and ensure that databases can handle spikes in demand without needing to provision resources for each one individually.

3. Managed Instance

  • This model provides a fully managed SQL Server instance in the cloud.
  • It offers near 100% compatibility with on-premises SQL Server, making it easier to migrate existing applications to Azure.
  • Managed instances come with built-in features like automated backups, patching, and scaling while allowing you to use familiar SQL Server tools and features.

4. Hyperscale

  • The Hyperscale model is designed for very large databases that need to scale quickly and efficiently.
  • It allows you to expand your database size beyond the limits of traditional tiers, making it suitable for applications with massive data storage needs.
  • Hyperscale also offers fast backup and restore capabilities, as well as read replicas for improved performance.

Azure SQL Database Services

Azure SQL Database offers a variety of services designed to help you manage and optimize your databases in the cloud. Here are some key services provided by Azure SQL Database:

1. Database as a Service (DBaaS):

  • Azure SQL Database is a fully managed service, meaning Microsoft takes care of maintenance tasks like backups, updates, and scaling.
  • This allows you to focus on developing your applications without worrying about the underlying infrastructure.

2. Automatic Backups:

  • The service automatically backs up your databases, allowing you to restore them to a specific point in time.
  • This feature ensures that your data is safe and can be recovered in case of accidental deletion or corruption.

3. Scaling and Elasticity:

  • Azure SQL Database allows you to easily scale your database resources up or down based on your workload.
  • You can adjust performance levels without downtime, making it suitable for applications with varying demands.

4. High Availability:

  • The service provides built-in high availability with a service level agreement (SLA) of up to 99.99%.
  • This means your applications can rely on Azure SQL Database to be online and accessible most of the time.

5. Advanced Security Features:

  • Azure SQL Database includes security features like encryption, threat detection, and auditing to help protect your data.
  • These features help ensure compliance with industry standards and safeguard against unauthorized access.

6. Intelligent Performance:

  • The service offers built-in intelligence that analyzes your database performance and provides recommendations for optimization.
  • Features like automatic tuning help improve query performance without manual intervention.

7. Geo-Replication:

  • Azure SQL Database supports geo-replication, allowing you to create readable secondary databases in different regions.
  • This feature enhances disaster recovery and improves performance for users in various locations.

8. Integration with Azure Services:

  • Azure SQL Database easily integrates with other Azure services, such as Azure Functions, Power BI, and Azure Logic Apps.
  • This integration allows you to build powerful applications and analytics solutions that leverage your database.

9. Serverless Options:

  • The serverless tier automatically pauses your database during inactivity and resumes when needed, helping you save costs.
  • You only pay for the compute resources used during active periods, making it ideal for variable workloads.

Querying using Azure SQL Database

Querying in Azure SQL Database is similar to querying in any SQL Server environment, as it uses Transact-SQL (T-SQL) for database operations. Here’s a simple overview of how to query using Azure SQL Database:

1. Connecting to Azure SQL Database

To start querying, you first need to connect to your Azure SQL Database. You can use various tools like:

  • Azure Data Studio: A cross-platform database tool for data professionals.
  • SQL Server Management Studio (SSMS): A popular tool for managing SQL Server databases.
  • Azure Portal: You can run queries directly in the Azure Portal using the Query Editor.
  • Programming Languages: You can also connect using programming languages like C#, Python, or Java through their respective libraries.

2. Basic Query Structure

A typical SQL query follows this structure:

 SELECT column1, column2
 FROM table_name
 WHERE condition;   

For example, to select all records from a table called "Customers":

 SELECT * FROM Customers;    

3. Filtering Data

You can filter results using the WHERE clause. For example:

 SELECT * FROM Customers
 WHERE Country = 'USA';  

4. Sorting Results

Use the ORDER BY clause to sort your results. For example:

 SELECT * FROM Customers
 ORDER BY LastName ASC;    

5. Joining Tables

You can combine data from multiple tables using joins. For example, to join "Orders" and "Customers":

 SELECT Customers.CustomerName, Orders.OrderID
 FROM Customers
 INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID;    

6. Aggregating Data

Use aggregate functions like COUNT, SUM, AVG, etc., to summarize data. For example:

 SELECT COUNT(*) AS TotalOrders
 FROM Orders
 WHERE OrderDate >= '2023-01-01';    

7. Using Stored Procedures

You can create and execute stored procedures for complex queries or repetitive tasks. For example:

CREATE PROCEDURE GetCustomerOrders
 @CustomerID INT
 AS
 BEGIN
     SELECT * FROM Orders WHERE CustomerID = @CustomerID;
 END;    

Guide to Create Azure SQL Database

To create anAzure SQL Database, first, you should log in to your Azure account and then follow these steps to create your Azure SQL Database:

Step1. Go to your Azure Portal

Azure SQl Database

Step 2. In the Azure Portal, select the "+ Create a resource" option located in the upper left corner, then search for Azure SQL.

Azure SQl Database

Step 3. Click on the "Create" button on the Azure SQL page that appears.

Step 4. Take a look at the various Azure SQL options available, and under the SQL databases section, make sure to choose the "Single Database" option before clicking on "Create.

Azure SQl Database

Step 5. A new page for creating your SQL database will appear. Enter the required details as follows:

  • Subscription: Choose the Azure subscription under which you want to create the resource.
  • Resource Group: Select the resource group for your new resource, or create a new one by clicking on the "Create new" option and entering your preferred name.

Azure SQl Database

  • Database Name: Provide a name for your database.
  • Server: Click on the "Create new" option to set up a new server with a unique name in your chosen location. Use SQL authentication, and for the server admin login, enter your name along with a strong password to ensure security.

Azure SQl Database

  • SQL Elastic Pool: Indicate whether you want to utilize a SQL Elastic Pool.
  • Compute + Storage: Select your options or keep the default settings.
  • Backup Storage Redundancy: Select locally redundant backup storage for your backups.

Azure SQl Database

Step 6. Next, click on "Next: Networking" to configure the network settings. For now, choose "Public endpoint" under the Network connectivity section. In the Firewall rules section, select "Yes" for both options to enable access to the database server from Azure services and your current client IP address.

Azure SQl Database

Step 7. Next, click on "Next: Security" to set up the database security. For now, choose "Not now" for the Enable Microsoft Defender for SQL option.

Azure SQl Database

Step 8. Next, click on "Next: Additional Settings" to configure some extra settings for the database. For now, select the "Use existing data" option and choose "Sample."

Step 9. Finally, click on "Review + Create" to examine the various configurations of the database.

Azure SQl Database

Step 10. If everything looks good, click "Create" to set up your Azure SQL database.

Step 11. Wait for the deployment to finish, then navigate to the deployed resource.

Azure SQl Database

Pricing for Azure SQL Database

Azure SQL Database offers two primary pricing models: vCore (virtual cores) and DTU (Database Transaction Units). Each model has its own way of measuring resources and pricing, allowing you to choose the one that best fits your needs. Let’s break down each model, including pricing in both the United States and India.

1. DTU Model (Database Transaction Units)

The DTU model is a blended measure of compute, storage, and I/O resources. Think of it as a package deal where you pay for a certain level of performance that combines these resources into a single unit. This model is straightforward and is often easier for users who want a simple way to understand their database performance.

Pricing in the United States

  • Basic Tier: Starts at around $5 per month for light workloads.
  • Standard Tier: Ranges from $15 to $300 per month, depending on the number of DTUs you choose (from 10 DTUs to 300 DTUs).
  • Premium Tier: Starts at about $30 per month and can go up to $3,000 or more per month for higher DTU levels (up to 4,000 DTUs).

Pricing in India

  • Basic Tier: Starts at approximately ₹350 per month.
  • Standard Tier: Ranges from ₹1,500 to ₹25,000 per month, depending on the DTUs selected.
  • Premium Tier: Starts at around ₹2,000 per month and can exceed ₹1,50,000 per month for higher performance needs.

Use Case: The DTU model is great for users who prefer a simple, all-in-one pricing structure and want to avoid the complexity of managing individual resources.

2. vCore Model (Virtual Cores)

The vCore model provides more flexibility and transparency. It allows you to choose the number of virtual cores (vCores) and separate the compute and storage resources. This model is particularly beneficial for users who want to customize their database performance based on specific workloads.

Pricing in the United States

  • General Purpose Tier: Starts at around $15 per month for 1 vCore and can go up to $1,500 or more per month for higher configurations.
  • Business Critical Tier: Starts at about $30 per month for 1 vCore and can exceed $3,000 per month for higher performance needs.

Pricing in India:

  • General Purpose Tier: Starts at approximately ₹1,500 per month for 1 vCore and can go up to ₹1,00,000 or more per month for higher configurations.
  • Business Critical Tier: Starts at around ₹2,000 per month for 1 vCore and can exceed ₹2,00,000 per month for higher performance.

Use Case: The vCore model is ideal for users who need more control over their resources and want to optimize their database for specific workloads. It also allows for easier scaling and better alignment with on-premises SQL Server environments.

Deleting Database in Azure SQL

Deleting a database in Azure SQL Database can be done through various methods, including the Azure Portal and Azure CLI. Below are detailed steps for both methods.

Method 1: Delete a Database Using Azure Portal

1. Log in to the Azure Portal

Go to the Azure Portal and log in with your Azure account credentials.

2. Navigate to SQL Databases

In the left-hand menu, click on "SQL databases". This will display a list of all your SQL databases.

3. Select the Database

Find the database you want to delete from the list and click on its name to open the database's overview page.

4. Delete the Database

In the database overview page, look for the "Delete" option in the top menu bar. Click on it.

5. Confirm Deletion

A confirmation dialog will appear, asking you to confirm the deletion. You may need to type the name of the database to confirm that you want to delete it. This is a safety measure to prevent accidental deletions.

  • After typing the database name, click on the "Delete" button.

6. Wait for Deletion

The deletion process will begin, and you will see a notification once the database has been successfully deleted.

Delete a Database Using Azure CLI

1: Open Azure CLI

You can use Azure CLI in several ways: through the Azure Cloud Shell in the Azure Portal, by installing the Azure CLI on your local machine, or using a terminal that supports Azure CLI commands.

2: Log in to Azure

If you are using a local installation, log in to your Azure account by running the following command:

 az login

Follow the prompts to authenticate.

3: Set the Subscription (if necessary)

If you have multiple subscriptions, set the active subscription using:

 az account set --subscription "Your Subscription Name"

Step 4: Delete the Database

Use the following command to delete the database. Replace <resource-group-name>, <server-name>, and <database-name> with your actual resource group name, SQL server name, and database name:

 az sql db delete --resource-group <resource-group-name> --server <server-name> --name <database-name> --yes

The --yes flagis used to bypass the confirmation prompt.

5: Verify Deletion

You can verify that the database has been deleted by listing the databases in the server with the following command:

 az sql db list --resource-group <resource-group-name> --server <server-name>
Conclusion

In conclusion, the Azure SQL Database is a great tool for storing and managing your data in the cloud. It offers different options and features that can fit the needs of any business, big or small. With Azure SQL Database, you can make sure your applications work well, grow easily, and provide a dependable experience for your users, leaving you happy with your choice of a cloud database. Join our Free Technology Courses for better learning and clearing your doubts.

Unlock your potential by joining our Azure Cloud DevOps certification courses and Azure AI Engineer certification courses, where you'll gain essential skills that are highly sought after in today’s job market. Don’t miss this opportunity to enhance your career and stand out to employers!

Further Read:
A Comprehensive Guide to Azure Database Services
Exploring Azure Blob Storage: Types, Tiers, and Benefits
Understanding Azure Load Balancer

Practice yourself with Azure SQL Database MCQs

Q 1: What type of database service is Azure SQL Database?

  • (a) On-premises database
  • (b) Infrastructure as a Service (IaaS)
  • (c) Platform as a Service (PaaS)
  • (d) Software as a Service (SaaS)

Q 2: Which tool is commonly used to manage Azure SQL Database?

  • (a) SQL Server Management Studio (SSMS)
  • (b) Azure Data Studio
  • (c) Azure Portal
  • (d) All of the above
Answer: (d) All of the above

Explanation: Azure SQL Database can be managed using SQL Server Management Studio (SSMS), Azure Data Studio, and the Azure Portal for flexibility.

Q 3: Which of the following backup options does Azure SQL Database support?

  • (a) Manual backups only
  • (b) Automated backups only
  • (c) Automated and Point-in-Time backups
  • (d) No backup options available
Answer: (c) Automated and Point-in-Time backups

Explanation: Azure SQL Database provides automated backups and Point-in-Time Restore for comprehensive data recovery options.

Q 4: What is the maximum database size supported by Azure SQL Database in the Hyperscale tier?

  • (a) 1 TB
  • (b) 5 TB
  • (c) 100 TB
  • (d) 500 TB
Answer: (c) 100 TB

Explanation: The Hyperscale tier in Azure SQL Database supports up to 100 TB of storage, allowing for large-scale workloads.

Q 5: Which SQL Server feature is not supported by Azure SQL Database?

  • (a) Always Encrypted
  • (b) SQL Server Agent
  • (c) Full-Text Search
  • (d) JSON Support
Answer: (b) SQL Server Agent

Explanation: Azure SQL Database does not support SQL Server Agent. Instead, automation is handled using Azure Logic Apps or Elastic Database Jobs.

FAQs

Azure SQL Database is a cloud-based service, while SQL Server is a traditional on-premises product. Azure SQL Database handles patching, backups, and high availability automatically, whereas SQL Server requires manual configuration and management. 

An elastic pool allows you to share resources across multiple databases to optimize costs and performance for unpredictable workloads.

Transparent Data Encryption encrypts data at rest to protect it from unauthorized access.

Yes, you can use tools like the Azure Database Migration Service or SQL Server Management Studio (SSMS) to migrate databases to Azure SQL Database.

Take our Azure skill challenge to evaluate yourself!

In less than 5 minutes, with our skill challenge, you can identify your knowledge gaps and strengths in a given skill.

GET FREE CHALLENGE

Share Article
About Author
Shailendra Chauhan (Microsoft MVP, Founder & CEO at ScholarHat)

Shailendra Chauhan, Founder and CEO of ScholarHat by DotNetTricks, is a renowned expert in System Design, Software Architecture, Azure Cloud, .NET, Angular, React, Node.js, Microservices, DevOps, and Cross-Platform Mobile App Development. His skill set extends into emerging fields like Data Science, Python, Azure AI/ML, and Generative AI, making him a well-rounded expert who bridges traditional development frameworks with cutting-edge advancements. Recognized as a Microsoft Most Valuable Professional (MVP) for an impressive 9 consecutive years (2016–2024), he has consistently demonstrated excellence in delivering impactful solutions and inspiring learners.

Shailendra’s unique, hands-on training programs and bestselling books have empowered thousands of professionals to excel in their careers and crack tough interviews. A visionary leader, he continues to revolutionize technology education with his innovative approach.
Accept cookies & close this