0% found this document useful (0 votes)
8 views8 pages

Module 2

Uploaded by

Neha Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
8 views8 pages

Module 2

Uploaded by

Neha Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 8

Module 2 :

Explore relational data in Azure


Understand relational data
In a relational database, you model collections of entities from the real world as tables. An entity can be
anything for which you want to record information; typically important objects and events. For example, a retail
system

Relational tables are a format for structured data, and each row in a table has the same columns; though in
some cases, not all columns need to have a value – for example, a customer table might include
a MiddleName column; which can be empty (or NULL) for rows that represent customers with no middle name
or whose middle name is unknown.

Understand normalization
Normalization is a term used by database professionals for a schema design process that minimizes
data duplication and enforces data integrity.

While there are many complex rules that define the process of refactoring data into various levels
(or forms) of normalization, a simple definition for practical purposes is:

1. Separate each entity into its own table.


2. Separate each discrete attribute into its own column.
3. Uniquely identify each entity instance (row) using a primary key.
4. Use foreign key columns to link related entities.

Explore SQL
SQL stands for Structured Query Language, and is used to communicate with a relational database. It's the
standard language for relational database management systems. SQL statements are used to perform tasks
such as update data in a database, or retrieve data from a database. Some common relational database
management systems that use SQL include Microsoft SQL Server, MySQL, PostgreSQL, MariaDB, and Oracle.

Some popular dialects of SQL include:

 Transact-SQL (T-SQL). This version of SQL is used by Microsoft SQL Server and Azure SQL
services.

 pgSQL. This is the dialect, with extensions implemented in PostgreSQL.

 PL/SQL. This is the dialect used by Oracle. PL/SQL stands for Procedural Language/SQL.
SQL statement types

SQL statements are grouped into three main logical groups:

 Data Definition Language (DDL)


 Data Control Language (DCL)
 Data Manipulation Language (DML)

DDL statements

You use DDL statements to create, modify, and remove tables and other objects in a database (table,
stored procedures, views, and so on).

DCL statements

Database administrators generally use DCL statements to manage access to objects in a database by
granting, denying, or revoking permissions to specific users or groups.
DML statements

You use DML statements to manipulate the rows in tables. These statements enable you to retrieve
(query) data, insert new rows, or modify existing rows. You can also delete rows if you don't need
them anymore.

Describe database objects


What is a view?

A view is a virtual table based on the results of a SELECT query. You can think of a view as a window
on specified rows in one or more underlying tables. For example, you could create a view on
the Order and Customer tables that retrieves order and customer data to provide a single object that
makes it easy to determine delivery addresses for orders
What is a stored procedure?

A stored procedure defines SQL statements that can be run on command. Stored procedures are used
to encapsulate programmatic logic in a database for actions that applications need to perform when
working with data.

What is an index?

An index helps you search for data in a table. Think of an index over a table like an index at the back
of a book. A book index contains a sorted set of references, with the pages on which each reference
occurs.

Knowledge check
Choose the best response for each of the questions below. Then select Check your answers.

1. Which one of the following statements is a characteristic of a relational database?

All columns in a table must be of the same data type.


A row in a table represents a single instance of an entity.

That's correct. Each row in a table represents an instance of an entity.


Rows in the same table can contain different columns.
2. Which SQL statement is used to query tables and return data?

QUERY
READ
SELECT

That's correct. Use the SELECT statement to query one or more tables and return data.
3. What is an index?

A structure that enables queries to locate rows in a table quickly

That's correct. Indexes improve query performance by locating rows with indexed column values.
A virtual table based on the results of a query
A predefined SQL statement that modifies data
Explore relational database services in Azure

Azure SQL is a collective term for a family of Microsoft SQL Server based database services in Azure.
Specific Azure SQL services include:

 SQL Server on Azure Virtual Machines (VMs) - A virtual machine running in Azure with an
installation of SQL Server. The use of a VM makes this option an infrastructure-as-a-service
(IaaS) solution that virtualizes hardware infrastructure for compute, storage, and networking in
Azure; making it a great option for "lift and shift" migration of existing on-premises SQL Server
installations to the cloud.
 Azure SQL Managed Instance - A platform-as-a-service (PaaS) option that provides near-100%
compatibility with on-premises SQL Server instances while abstracting the underlying hardware
and operating system. The service includes automated software update management, backups,
and other maintenance tasks, reducing the administrative burden of supporting a database
server instance.
 Azure SQL Database - A fully managed, highly scalable PaaS database service that is designed
for the cloud. This service includes the core database-level capabilities of on-premises SQL
Server, and is a good option when you need to create a new application in the cloud.
 Azure SQL Edge - A SQL engine that is optimized for Internet-of-things (IoT) scenarios that
need to work with streaming time-series data.

SQL Server on Azure Virtual Machines

SQL Server on Virtual Machines enables you to use full versions of SQL Server in the Cloud without
having to manage any on-premises hardware. This is an example of the IaaS approach.
Azure SQL Database Managed Instance

Azure SQL Managed instance effectively runs a fully controllable instance of SQL Server in the cloud.
You can install multiple databases on the same instance. You have complete control over this
instance, much as you would for an on-premises server.

Azure SQL Database

Azure SQL Database is a PaaS offering from Microsoft. You create a managed database server in the
cloud, and then deploy your databases on this server.

Azure SQL Database is available as a Single Database or an Elastic Pool.

Single Database

This option enables you to quickly set up and run a single SQL Server database. You create and run a
database server in the cloud, and you access your database through this server. Microsoft manages
the server, so all you have to do is configure the database, create your tables, and populate them with
your data.

Elastic Pool

This option is similar to Single Database, except that by default multiple databases can share the same
resources, such as memory, data storage space, and processing power through multiple-tenancy. The
resources are referred to as a pool. You create the pool, and only your databases can use the pool.
This model is useful if you have databases with resource requirements that vary over time, and can
help you to reduce costs.

Describe Azure services for open-source


databases
What are MySQL, MariaDB, and PostgreSQL?

MySQL, MariaDB, and PostgreSQL are relational database management systems that are tailored for
different specializations.
MySQL started life as a simple-to-use open-source database management system. It's the leading
open source relational database for Linux, Apache, MySQL, and PHP (LAMP) stack apps. It's available in
several editions; Community, Standard, and Enterprise. The Community edition is available free-of-
charge, and has historically been popular as a database management system for web applications,
running under Linux. Versions are also available for Windows. Standard edition offers higher
performance, and uses a different technology for storing data. Enterprise edition provides a
comprehensive set of tools and features, including enhanced security, availability, and scalability. The
Standard and Enterprise editions are the versions most frequently used by commercial organizations,
although these versions of the software aren't free.

MariaDB is a newer database management system, created by the original developers of MySQL. The
database engine has since been rewritten and optimized to improve performance. MariaDB offers
compatibility with Oracle Database (another popular commercial database management system). One
notable feature of MariaDB is its built-in support for temporal data. A table can hold several versions
of data, enabling an application to query the data as it appeared at some point in the past.

PostgreSQL is a hybrid relational-object database. You can store data in relational tables, but a
PostgreSQL database also enables you to store custom data types, with their own non-relational
properties. The database management system is extensible; you can add code modules to the
database, which can be run by queries. Another key feature is the ability to store and manipulate
geometric data, such as lines, circles, and polygons.

PostgreSQL has its own query language called pgsql. This language is a variant of the standard
relational query language, SQL, with features that enable you to write stored procedures that run
inside the database.

Azure Database for MySQL

Azure Database for MySQL is a PaaS implementation of MySQL in the Azure cloud, based on the
MySQL Community Edition.

The Azure Database for MySQL service includes high availability at no additional cost, and scalability
as required. You only pay for what you use. Automatic backups are provided, with point-in-time
restore.

Azure Database for MariaDB

Azure Database for MariaDB is an implementation of the MariaDB database management system
adapted to run in Azure. It's based on the MariaDB Community Edition.

The database is fully managed and controlled by Azure. Once you've provisioned the service and
transferred your data, the system requires almost no additional administration.
Azure Database for PostgreSQL

If you prefer PostgreSQL, you can choose Azure Database for PostgreSQL to run a PaaS
implementation of PostgreSQL in the Azure Cloud. This service provides the same availability,
performance, scaling, security, and administrative benefits as the MySQL service.

Azure Database for PostgreSQL Flexible Server

The flexible-server deployment option for PostgreSQL is a fully managed database service. It provides
a high level of control and server configuration customizations, and provides cost optimization
controls.

Knowledge check
1. Which deployment option offers the best compatibility when migrating an existing SQL
Server on-premises solution?

Azure SQL Database (single database)


Azure SQL Database (elastic pool)
Azure SQL Managed Instance

Correct. Azure SQL Managed Instance offers near 100% compatibility with SQL Server.
2. Which of the following statements is true about Azure SQL Database?

Most database maintenance tasks are automated

Correct. Azure SQL Database automates most maintenance tasks.


You must purchase a SQL Server license
It can only support one database
3. Which database service is the simplest option for migrating a LAMP application to Azure?

Azure SQL Managed Instance


Azure Database for MySQL

Correct. LAMP standard for Linux, Apache, MySQL, and PHP.


Azure Database for PostgreSQL

You might also like