Professional Documents
Culture Documents
Contents
Introduction ................................................................................................................ 3
1. Revised Entity Relation Diagram for Task 2 ........................................................ 4
2. Table Creation in SQL SERVER.......................................................................... 5
3. Table Population in SQL SERVER ...................................................................... 6
4. Queries ................................................................................................................ 9
4.1. ALL EMPLOYEES THAT HAVE WORKED ON A JOB ................................. 9
4.2. MATERIALS USED ON EACH JOB CARD WITH FULL CONVERSION .... 10
4.3. JOB CARDS THAT CHRIS BYNE HAS WORKED ON ............................... 11
4.4. JOB CARDS THAT HAVE TAKEN PLACE IN ADDRESSES THAT
CONTAIN '0001' OR '0002' ................................................................................... 12
4.5. NUMBER OF JOB CARDS THAT HAVE USED ELECTRICAL WIRING .... 13
4.6. QUERY FOR INVOICE USE ....................................................................... 14
4.7 UPDATE Query ............................................................................................... 16
5. Data Migration ................................................................................................... 17
6. Conclusion ......................................................................................................... 23
7. References ........................................................................................................ 24
2|Page
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
Introduction
Domingo Roof Works is a small company that deals in converting rooftops and lofts
into liveable rooms or quarters. In this POE (Task 2), I will be creating a database to
store a copy of their hard copy records. I will also create relationships between the
various entities.
I have also revised the Entity Relationship Diagram from Task 1. I will be migrating
the database to an online cloud platform (MICROSOFT AZURE).
3|Page
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
I have also used a star structure to extract the primary keys from the outer tables by
using the one inner table (JOB_DETAILS). The main table has no primary keys, but
does have 4 foreign keys and lone attribute (NO_OF_DAYS).
4|Page
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
5|Page
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
6|Page
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
7|Page
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
This is the inner table. It references all the data from the outer tables by using their
primary keys. It has four foreign key constraints that relies on the primary keys of the
other tables.
8|Page
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
4. Queries
4.1. ALL EMPLOYEES THAT HAVE WORKED ON A JOB
In this query, I have used the JOB_CARD_NO, EMPLOYEE_ID and
EMPLOYEE_NAME (FIRST_NAME + SECOND NAME).
The question needed us to show the JOB_CARD_NO that each employee has
worked on. To do this, I used the EMPLOYEE, JOB_DETAILS and
JOB_MATERIALS tables. I included a WHERE statement that merges the unique
values for JOB_CARD_NO and EMPLOYEE_ID, so it would remove any redundant
data.
CODE:
SCREENSHOT:
Below is a screenshot of the output of my query.
9|Page
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
SCREENSHOT:
Below is a screenshot of the output of my query.
10 | P a g e
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
SCREENSHOT:
Below is a screenshot of the output of my query.
11 | P a g e
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
4.4. JOB CARDS THAT HAVE TAKEN PLACE IN ADDRESSES THAT CONTAIN '0001'
OR '0002'
In this query, I needed to select all records that had a postal code that was equal to
‘0001’ or ‘0002’. I used the JOB_CARD_NO, CUSTOMER_ID and POSTAL_CODE
attributes in my SELECT statement.
For this query, I used the ADDRESS, CUSTOMER, JOB_DETAILS and the
JOB_MATERIALS tables.
The WHERE statement can be viewed below:
CODE:
SCREENSHOT:
Below is a screenshot of the output of my query.
12 | P a g e
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
SCREENSHOT:
Below are the screenshots of the output of my queries.
13 | P a g e
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
SCREENSHOT:
Below are the screenshots of the output of my queries.
NB: The screenshots below all fit on one line, it is the combined output of
three screenshots on one query. Each row represents an invoice sample.
14 | P a g e
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
15 | P a g e
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
Screenshots:
16 | P a g e
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
5. Data Migration
At this stage, the database is complete and the queries have been executed. I
have reviewed my queries and fixed any form of errors.
The next step in this POE – TASK 2 is to migrate the database onto a cloud
platform. To accomplish this, I will be using Microsoft AZURE.
Firstly, we need to logon to the portal at https://azure.microsoft.com/en-
in/free/students/ .
The next step is to navigate over to the portal, located at the top right of the
screen.
17 | P a g e
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
Now that we have entered the portal, locate the SQL DATABASES tab to the left
of the screen. It is in the list menu to the left of the screen.
Once you have located it, open its tab and select Create SQL Database.
18 | P a g e
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
Now that you have followed the steps to creating an instance of an azure
database on the portal, we need to deploy the database from SQL SERVER on
the local Machine
To accomplish this, we need to connect to our database in SQL SERVER.
Navigate to the right of the window and right click on the database that we are
using. Scroll down to TASKS and select extract Data tier Application.
19 | P a g e
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
The next step is to follow the on-screen prompts to save your database as a
BACPAC file on your local Disk.
20 | P a g e
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
Click next to view your summary and to see the results at the end.
The next step is to Import a BACPAC file into SQL SERVER using an Azure
Connection.
21 | P a g e
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
Once it connects you can view the database and validate it to check if it is online.
In SSMS navigate to the instance of your Database.
This will let you know whether your database is online or not. You can also navigate
to the AZURE portal, as discussed previously to view the SQL DATABASES that
have been created and also to check if they are online.
22 | P a g e
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
6. Conclusion
At this stage, all the database objects have been migrated to the AZURE online
cloud platform and has been validated and checked that it is online. The database
works and is fully functional.
23 | P a g e
Mckaylan Perumalsami CLDV6211 – POE Task 2 Student Number: 18003974
7. References
1. Montalvao, V. (2019). Learn how to Migrate a SQL Server database to SQL Azure server.
[online] Mssqltips.com. Available at: https://www.mssqltips.com/sqlservertip/5255/learn-how-
to-migrate-a-sql-server-database-to-sql-azure-server/ [Accessed 7 May 2019].
2. Chao, L. (2014). Cloud database development and management. Boca Raton: Taylor &
Francis.
3. mobilerootindia (2016). How to Move SQL Database from Local SQL Server to Azure SQL
Server Step by Step tutorial. [video] Available at:
https://www.youtube.com/watch?v=NfTTw5JqnRk&t=20s [Accessed 7 May 2019].
5. SherWeb. (2019). Azure Data Migration - Five Ways to get your data in the cloud. [online]
Available at: https://www.sherweb.com/blog/cloud-server/azure-data-migration/ [Accessed 7
May 2019].
24 | P a g e