Microsoft Azure ‘Always’ free Database Things
I am continuing my DP-900 Exam prep, and here, exploring the many free databases offered by Microsoft.
You can see that Microsoft (as with so many cloud providers) offers a bunch of stuff for free.
For instance, one of my demo projects, Phoblober, works with translation services and OCR services, from a free API key.
Now, I want to prep for DP-900, I decided to get some hands on with Azure databases, without spending any money. A quick glance on the list of services, gives the following free stuff.
- Azure Cosmos DB
- SQL Database
I was going to spin up a local database with SQL Management Studio, but, now, since it’s free, might as well, get one from Azure. Let’s go then.
Starting with Azure Cosmos.
Cosmo is working just fine. I used this example project from Azure, as a reference dot net app. note: The repo is archived, but, I was able to fix and debug it before running. You can find my version, here.
And, that is the story with cosmos.
Now, let’s look at Azure SQL then, also free.
and it’s ready. You can find the queries, here.
Here are the scripts I used.
-- Create Customers table
CREATE TABLE Customers (
CustomerID INT IDENTITY(1,1) PRIMARY KEY,
FirstName NVARCHAR(50),
LastName NVARCHAR(50),
Email NVARCHAR(100),
Phone NVARCHAR(20),
CreatedAt DATETIME DEFAULT GETDATE()
);
-- Create Products table
CREATE TABLE Products (
ProductID INT IDENTITY(1,1) PRIMARY KEY,
ProductName NVARCHAR(100),
Price DECIMAL(18, 2),
StockQuantity INT,
CreatedAt DATETIME DEFAULT GETDATE()
);
-- Create Orders table
CREATE TABLE Orders (
OrderID INT IDENTITY(1,1) PRIMARY KEY,
CustomerID INT,
OrderDate DATETIME DEFAULT GETDATE(),
TotalAmount DECIMAL(18, 2),
FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID)
);
-- Create OrderDetails table (junction table)
CREATE TABLE OrderDetails (
OrderDetailID INT IDENTITY(1,1) PRIMARY KEY,
OrderID INT,
ProductID INT,
Quantity INT,
UnitPrice DECIMAL(18, 2),
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
FOREIGN KEY (ProductID) REFERENCES Products(ProductID)
);
-- Insert sample data into Customers table
INSERT INTO Customers (FirstName, LastName, Email, Phone)
VALUES
('John', 'Doe', 'john.doe@example.com', '123-456-7890'),
('Jane', 'Smith', 'jane.smith@example.com', '987-654-3210');
-- Insert sample data into Products table
INSERT INTO Products (ProductName, Price, StockQuantity)
VALUES
('Laptop', 999.99, 50),
('Smartphone', 599.99, 100),
('Headphones', 199.99, 200);
-- Insert sample data into Orders table
INSERT INTO Orders (CustomerID, TotalAmount)
VALUES
(1, 1599.98),
(2, 199.99);
-- Insert sample data into OrderDetails table
INSERT INTO OrderDetails (OrderID, ProductID, Quantity, UnitPrice)
VALUES
(1, 1, 1, 999.99),
(1, 2, 1, 599.99),
(2, 3, 1, 199.99);
SELECT * FROM Customers;
SELECT * FROM Products;
SELECT * FROM Orders;
SELECT * FROM OrderDetails;
So, there we go. Free database options, good enough for learning and practice.
I work as a coding tutor. You can hire me on Upwork, Fiverr and Codementor. You can also book a session on calendly, and visit my website. Also, video tutorials on my YouTube Channel. My Podcast is here.