logo

Documentation Introduction Assignment 2022

5 Pages769 Words12 Views
   

Added on  2022-10-18

Documentation Introduction Assignment 2022

   Added on 2022-10-18

ShareRelated Documents
Documentation
Introduction:
JSON (JavaScript Object Notation) which is the lightweight format which is used to
interchange data. The JSON format are easy for the human to read, write and understand and
easy for the computer to parse them and extract data. The task of the assignment is to implement
the JSON field into the existing customer table of the classic mode database. Then insert 3 data
values into the customer table and to finally display the customer details which contains data in
the JSON field. The assignment also describes about JSON together with its significant
advantages and disadvantages (Tahaghoghi & Tahaghoghi, 2011).
Task:
Adding JSON Field to Customers Table:
The initial structure of the Customer table is given below:
A JSON field named “customers_contacts” is added to the Customer table using the following
query (Glendon, 2011):
Query:
ALTER TABLE customers ADD COLUMN customers_contacts JSON DEFAULT NULL;
Now the structure of the customer table is modified as shown below:
Documentation Introduction Assignment 2022_1
Inserting data into JSON Field:
The customers table’s “customers_contacts” JSON field is inserted with the following keys data:
customerNumber
contactLastName
contactFirstName
The SQL query used to insert 3 values to the JSON field of the customer table is given below
Query:
update customers set
customers_contacts='{"customerNumber": 103, "contactLastName": "Schmitt",
"contactFirstName": "Carine"}'
where customerNumber=103;
update customers set
customers_contacts='{"customerNumber": 112, "contactLastName": "King",
"contactFirstName": "Jean"}'
where customerNumber=112;
update customers set
customers_contacts='{"customerNumber": 114, "contactLastName": "Ferguson",
"contactFirstName": "Peter"}'
where customerNumber=114;
Documentation Introduction Assignment 2022_2

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Research and SQL Queries
|11
|831
|352

NoSQL Database: Types and Uses
|9
|848
|395

NoSQL Database: Key-Value, Document-Based, Column-Based, Graph-Based
|11
|689
|420

Working with MongoDB: Database Structure and Querying
|7
|1182
|336

Research and SQL Queries
|10
|692
|446