0% found this document useful (0 votes)
26 views64 pages

Adt Lab11

The document is a lab manual for the Advanced Database Technology course at Anna University, detailing various database technologies including MongoDB, Cassandra, OrientDB, and MySQL. It provides installation procedures, sample data, and example queries for CRUD operations, indexing, and replication. The manual serves as a practical guide for students completing their laboratory work in database technology.

Uploaded by

subathra devi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views64 pages

Adt Lab11

The document is a lab manual for the Advanced Database Technology course at Anna University, detailing various database technologies including MongoDB, Cassandra, OrientDB, and MySQL. It provides installation procedures, sample data, and example queries for CRUD operations, indexing, and replication. The manual serves as a practical guide for students completing their laboratory work in database technology.

Uploaded by

subathra devi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 64

lOMoARcPSD|52618716

Advanced database technology lab manual

Advanced Database Technology (Anna University)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by subathra devi ([email protected])
lOMoARcPSD|52618716

UNIVERSITY COLLEGE OF ENGINEERING

BIT CAMPUS, ANNA UNIVERSITY,

TIRUCHIRAPPALLI- 620024

MC4211 ADVANCED DATABASE TECHNOLOGY LABORATORY

DEPARTMENT OF COMPUTER APPLICATIONS

Name : …………………………….

Register Number : …………………………….

Semester : …………………………….

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

UNIVERSITY COLLEGE OF ENGINEERING

BIT CAMPUS, ANNA UNIVERSITY,

TIRUCHIRAPPALLI- 620024

MC4211 ADVANCED DATABASE TECHNOLOGY LABORATORY

BONAFIDE CERTIFICATE

This is to certify that Mr/Ms/Mrs. ……………………….......... bearing the


Register No. ………………………. has satisfactorily completed the course of
ADVANCED DATABASE TECHNOLOGY LABORATORY (MC4211) for the
Second Semester of Master of Computer Applications during the year 2023 –
2025.

Faculty in charge Head of the Department

Submitted for the University Practical Examination held on …..............

Internal Examiner External Examiner

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

Sl. NO Date Content Page No. Signature

MongoDB-CRUD Operations, Indexing,


01
Sharding

Cassandra-Table Operations, CRUD Operations,


02
CQL Types

03 OrientDB Graph database-OrientDB Features

MYSQL Database Creation, Table Creation,


04
Query

05 MYSQL Replication-Distributed Databases

06 Spatial Data Storage and Retrieval in MYSQL

Temporal Data Storage and Retrieval in


07
MYSQL

08 Object Storage and Retrieval in MYSQL

XML Databases, XML Table Creation, XQuery


09
FLWOR Expression

Mobile Database Query Processing using Open-


10
Source DB (MongoDB/MYSQL etc.)

Hive-Data types, Database Operations,


11
Partitioning-HiveQL

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

MONGODB CRUD OPERATION

INSTALLATION PROCEDURE:

STEP 1: Login MONGODB ATLAS with Email ID

STEP 2: After the Login process the MongoDb Atlas Ask some question

STEP 3: Select the M0 Free database Server

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 4: Give the Cluster (or) Database name and proceed to Deployment the Server

STEP 5: A Window Pop up for Creating Username and password, then click the “Create
Username”

STEP 6: After that MongoDb database were created and Click the “Connect” button

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 7: After that the window will popped out, then click the “Shell menu”

STEP 8: The Last step to access the MongoDb via Command prompt

STEP 9; After installation the Mongosh, copy the command string in system command prompt
and Enter the password then the Database were Connected.

SAMPLE DATA:

Student_Id Name Company Name Salary


1 Nandhu Zoho 70.000
2 Vijay TCS 75.000
3 Loganathan IBM 80.000
4 Sobiya Accenture 75.000
5 Jerish Amazon 85.000
6 Saranya HCL 85.000
7 Jayachandran Google 1.00.000
8 Harshavardhan Wipro 80.000

QUERIES:

//CREATE
>use MCA_Placement
//INSERT
>db.user.insertMany([{Student_id:"1",Student_name:"Nandhu",Company:"Zoho",Salary:'70000'}
,{Student_id:"2",Student_name:"Vijay",Company:"TCS",Salary:'75000'},{Student_id:"3",Student

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

_name:"Loganathan",Company:"IBM",Salary:'80000'},{Student_id:"4",Student_name:"Sobiya",C
ompany:"Accenture",Salary:'75000'},{Student_id:"5",Student_name:"Jerish",Company:"Amazon
",Salary:'85000'}, {Student_id:"6",Student_name:"Saranya",Company:"HCL",Salary:'85000'},
{Student_id:"7",Student_name:"Jayachandran",Company:"Google",Salary:'100000'},
{Student_id:"8",Student_name:"Harshavardhan",Company:"Wipro",Salary:'800
00'}])

// DISPLAY
>db.user.find()

//UPDATE
>db.user.updateOne({Student_name:"Nandhu"}, {$set: {Salary:'80000'}})
>db.user.find()

//DELETE
>db.user.deleteOne({Student_name:"Nandhu"})
>db.user.find()

//INDEXING
>db.user.createIndex({id:1})
>db.user.getIndexes()

//DROP INDEX
>db.user.dropIndex({id:1})
>db.user.getIndexes()

OUTPUT:

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

CASSANDRA: TABLE OPERATIONS, CRUD OPERATIONS, CQL TYPES


INSTALLATION PROCEDURE:
STEP 1: Install java 8
https://www.oracle.com/in/java/technologies/javase/javase8-archive-downloads.html

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 2: To install java 8 ,sign in to oracle by using username or mail with password.

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 3: Go to files -> Copy the file path of java ->Edit the system environment variables-
>System properties->New path->ok.

Next open the command prompt type java.

STEP 4: After installing java, install Python 2.7.17


https://www.python.org/downloads/release/python-2717/

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 5: Go to Environment variables -> Copy path -> Edit Environment variables -> New path -
> Ok.
Next open the command prompt type python.

STEP 6: Cassandra installation: install Cassandra using this following link.


https://cassandra.apache.org/doc/3.11/cassandra/getting_started/installing.html

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 7: After installing Cassandra, Go to System properties -> Environment variables -> New ->
copy path -> Edit environment variables ->paste path ->Ok.

Go to command prompt and type Cassandra -f

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

SAMPLE DATA:
book_id book_name book_author book_price book_rating
1 The power of Joseph Murphy 149 4.5
your
subconscious
mind
2 Ikigai Francesc 348 4.6
Miralles
3 The Psychology Morgan Housel 274 4.6
of Money
4 Word Power Norman Lewis 97 4.4
Made Easy
5 Moral Story Maple Press 220 4.5
Books for Kids

QUERIES:
cqlsh: create keyspace amaazon with replication
{‘class’:’Networktopologystrategy’,’datacenter1’:1};
cqlsh: use amaazon;
//CREATE
cqlsh: amaazon >create table booksellers(book_id int PRIMARYKEY, book_name text,
book_author text, book_rating float, book_price varint);
//INSERT
Cqlsh: amaazon >insert into booksellers (book_id, book_name, book_author, book_rating,
book_price) values (1,’The Power of Your Subconscious Mind’,’Joseph Murphy’,4.5,149);

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

insert into booksellers (book_id, book_name, book_author, book_rating, book_price) values (2,
‘Ikigai’, ’Francsec Miralles’, ,4.6,348);
insert into booksellers (book_id, book_name, book_author, book_rating, book_price) values
(3,’ThePhsychology of Money’, ‘Morgan Housel’,4.6,274);
insert into booksellers (book_id, book_name, book_author, book_rating, book_price) values (4,
‘Word power Made Essay’, ‘Norman Lewis’,4.4,97);
insert into booksellers (book_id, book_name, book_author, book_rating, book_price) values (5,
‘Moral Story Books for Kids’, ‘Maple Press’,4.5,220)
//DISPLAY
cqlsh:amaazon>select* from booksellers;
//UPDATE
cqlsh:amaazon> update booksellers set book_price=100 where book_id=4;
//DELETE
cqlsh:amaazon>delete from booksellers where book_id=5;

OUTPUT:

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

ORIENTDB GRAPH DATABASE -ORIENTDB FEATURES


INSTALLATION PROCEDURE:
OrientDB comes with built-in setup file to install the database on your system. It provides
different pre-compiled binary packages (tarred or zipped packages) for different operating
systems. You can download OrientDB files from orientdb community version link.
The following screenshot shows the download page of OrientDB. You can download
the zipped or tarred file by clicking the suitable operating system icon.

STEP 1: Download OrientDB in Softpedia and click Download now.


https://www.softpedia.com/get/Internet/Servers/Database-Utils/OrientDB.shtml

STEP 2: click DOWNLOAD: External mirror

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 3: open the zip file and extract to orientdb folder.

STEP 4: In orientdb folder, open bin folder and run the server and enter password and user
name in server.

STEP 5: open readme file and run it.

STEP 6: In readme file, copy this link http://localhost:2480 and paste it in chrome.

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

SAMPLE DATA:
Create new database> enter new database name and enter root password

In schema page, create new vertex

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

Add Properties to vertex

Add New Record to Properties

View the Table> Query: select * from vertex name

Example: select * from meta_app

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

Create Edge for Vertex>Query: Create class edge name extends E

Example: Create class insta_follower extends E

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

Connect vertexes using edge name> Query: Create edge from vertex @rid to vertex @rid

Example: Create edge from #22.0 to #30.0

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

OUTPUT:

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

MYSQL DATABASE CREATION, TABLE CREATION, QUERY

SAMPLE DATA:
USER_ID USER_NAME USER_AGE USER_GENDER

@acer198 San_jay 21 male

@carrier11 Sree_ram 21 male

@hittachi090 Giri_dharan 21 male

@today00 Revi 21 male

@adobe07 Jay_chandran 21 male

QUERIES:
create database LinkedIn;
use LinkedIn;
//CREATE
create table profile(user_id varchar(30), user_name varchar(20),user_age int);
//INSERT
insert into profile values("@acer198","san_jay",21);
insert into profile values("@carrier11","sree_ram",21);
insert into profile values("@hittachi090","giri_dharan",21);
insert into profile values("@today00","revi",21);
insert into profile values("@adobe07","jay_chandran",21);
select * from profile;
//ALTER
alter table profile add user_gender varchar(10);
//UPDATE
update profile set user_gender="male";
select * from profile;
//DELETE
delete from profile where user_id="@today00";

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

//DROP
drop table profile;
mysql> drop database LinkedIn;

OUTPUT:
//INSERT

//ALTER AND UPDATE:

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

//DELETE:

//DROP:

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

MYSQL REPLICATION
INSTALLATION PROCEDURE:

STEP 1: Make Sure Tick the Hidden items and The “ProgramData” was Shown in Folder
STEP 2: Create the Server in Mysql Workbench

• Click the Plus Button near the Mysql Connections to Create the Server
• Create the First Server named as Server A and Do the Same process for Server B.
• Click the Test Connection for both the Server and Click Ok.

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

• After the Creating the Server the Pop shows like this

• Click the Spanner icon to Locate the Configuration File

• Just copy this path to Configuration file “C:\ProgramData\MySQL\MySQL Server


8.0\my.ini” and Do add the configure file for both the server.

SERVER A:
server-id=1
log-bin="mysql-bin"
binlog-ignore-db=information_schema
replicate-ignore-db=information_schema
relay-log="mysql-relay-log"
auto-increment-increment = 2

SERVER B:
server-id=2
log-bin="mysql-bin"
binlog-ignore-db=information_schema
replicate-ignore-db=information_schema
relay-log="mysql-relay-log"
auto-increment-increment = 2

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

QUERIES:

1. Create the replicator user in either Server A and Server B. You can do that using MySql shell
using the following commands:

mysql > CREATE USER 'replicator'@'%' IDENTIFIED BY '[replicator_password]';


mysql > GRANT REPLICATION SLAVE ON *.* TO 'replicator'@'% ;

2. Here set your Replicator password in [replicator_password]

3. To Connect Server B to Server A as a Slave to Master Host, type the following sql
command in Mysql Workbench:

SHOW MASTER STATUS;

4. Now Connect to Server B via Mysql Workbench and type the following sql command:

STOP SLAVE;
CHANGE MASTER TO MASTER_HOST = 'Server A IP Address', MASTER_USER =
'replicator', MASTER_PASSWORD = '[replicator_password]', MASTER_LOG_FILE =
'mysql-bin.000001', MASTER_LOG_POS = 10
START SLAVE;

5. Lastly go to Server A and type sql command to show the slaves which were connected to
Master Host

SHOW SLAVE STATUS;

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

SPATIAL DATA STORAGE AND RETRIEVAL IN MYSQL

INSTALLATION PROCEDURE:

STEP 1: Firstly, choose the MySQL version and operating system. Then, we download the desired
MSI installer on your system by clicking the 'Download' button shown in the image below. This
installer is suitable for both 32-bit and 64-bit systems

STEP 2: Then, we will be redirected to another file download page. Here, ignore the prompts asking
to log in or sign up and directly start downloading by clicking on the link as shown in the image.

STEP 3: Once the installer is downloaded, run it to start the MySQL installation.

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 4: Now, we can see the installer community window, asking to choose a Setup type for our
MySQL products. Choose Custom and click Next to decide what products we want to actually
install.

STEP 5: In the next step, select MySQL Server, MySQL Workbench, MySQL Shell (all latest
versions) to be installed. We can also choose more products available as per necessity. Click Next

STEP 6: The installation process will now begin. However, path conflicts might arise if there exists
a path directory with the same name. After the installation is done, click Next.

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 7: In this step, we will be asked to set Type and Networking of MySQL. Unless there is any
particular change we want to make, it is recommended to keep the settings as they are, and
click Next.

STEP 8: Then, we need to set the Authentication method to access MySQL root user. So, choose
the strong password encryption method (as it is recommended) and click Next.

STEP 9: Set a password for the root account. This password must always be used to log into the
root account in every session. After setting password, click Next.

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 10: In this step, MySQL Server Instance will be configured as a Windows Service. The
default name will be set as "MySQL80", which can be changed if needed. Click Next.

STEP 11: Now, set the file permissions as required and click Next.

STEP 12: As shown in the image below, the specified configuration steps will be applied on
clicking Execute.

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

Once it is completed, click Finish. The next window will display the products on which the
configuration is applied. Click Next to finish the installation.

STEP 13: The installation is now complete. Uncheck the options asking to start MySQL
Workbench and Shell after setup, so that they will not run after setup. Click Finish.

The MySQL Server is now installed in the Windows Operating System. We can now access it via
the Command Prompt or the UI products we installed with it (Shell and Workbench)

SAMPLE DATA:

Name Location
Restaurant 1 -26.66115 40.95858
Restaurant 2 -26.68685 40.93992
Restaurant 3 -31.11924 42.39557

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

QUERIES:

mysql> create database empl;

mysql> use empl;

//CREATE

mysql> CREATE TABLE restaurants (name VARCHAR (100), location GEOMETRY NOT
NULL, SPATIAL INDEX (location));

//INSERT

mysql> INSERT INTO restaurants VALUES ('Restaurant 1', ST_GeomFromText ('POINT (-


26.66115 40.95858)')); INSERT INTO restaurants VALUES ('Restaurant 2', ST_GeomFromText
('POINT (-26.68685 40.93992)')); INSERT INTO restaurants VALUES ('Restaurant 3',
ST_GeomFromText ('POINT (-31.11924 42.39557)'));

mysql> SELECT * from restaurants;

//ALTER

mysql> alter table restaurants add salary point;

mysql> select * from restaurants;

// DELETE

mysql> DELETE from restaurants WHERE name = ”Restaurant 1”;

mysql> SELECT * from restaurants;

//DROP

mysql> DROP table restaurants;

mysql> SELECT * from restaurants;

OUTPUT

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

TEMPORAL DATA STORAGE AND RETRIEVAL IN MYSQL


SAMPLE DATA:
Vehicle_number Vehicle_model Entry_time id

TN_55_0001 BMW_M5 2024-06-03 1


14:50:24

TN_55_6969 ALTO_800 2024-06-03 2


14:55:11

QUERIES:
create database Toll;
use Toll;
//CREATE
create table vehicle(vehicle_number varchar(20),vehicle_model varchar(20), entry_time
datetime);
//INSERT
insert into vehicle values("TN_55_0001","BMW_M5",now());
insert into vehicle values("TN_55_6969","ALTO 800",now());
select * from vehicle;
//ALTER
ALTER TABLE vehicle ADD COLUMN id INT AUTO_INCREMENT PRIMARY KEY;

OUTPUT:

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

OBJECT STORAGE AND RETRIEVAL IN MYSQL

MYSQL INSTALLATION PROCEDURE

STEP 1: Firstly, choose the MySQL version and operating system. Then, we download the desired
MSI installer on your system by clicking the 'Download' button shown in the image below. This
installer is suitable for both 32-bit and 64-bit systems

STEP 2: Then, we will be redirected to another file download page. Here, ignore the prompts asking
to log in or sign up and directly start downloading by clicking on the link as shown in the image.

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 3: Once the installer is downloaded, run it to start the MySQL installation.

STEP 4: Now, we can see the installer community window, asking to choose a Setup type for our
MySQL products. Choose Custom and click Next to decide what products we want to actually
install.

STEP 5: In the next step, select MySQL Server, MySQL Workbench, MySQL Shell (all latest
versions) to be installed. We can also choose more products available as per necessity. Click Next.

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 6: The installation process will now begin. However, path conflicts might arise if there exists
a path directory with the same name. After the installation is done, click Next.

STEP 7: In this step, we will be asked to set Type and Networking of MySQL. Unless there is any
particular change we want to make, it is recommended to keep the settings as they are, and
click Next.

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 8: Then, we need to set the Authentication method to access MySQL root user. So, choose
the strong password encryption method (as it is recommended) and click Next.

STEP 9: Set a password for the root account. This password must always be used to log into the
root account in every session. After setting password, click Next.

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 10: In this step, MySQL Server Instance will be configured as a Windows Service. The
default name will be set as "MySQL80", which can be changed if needed. Click Next.

STEP 11: Now, set the file permissions as required and click Next.

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 12: As shown in the image below, the specified configuration steps will be applied on
clicking Execute.

Once it is completed, click Finish. The next window will display the products on which the
configuration is applied. Click Next to finish the installation.

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 13: The installation is now complete. Uncheck the options asking to start MySQL
Workbench and Shell after setup, so that they will not run after setup. Click Finish.

The MySQL Server is now installed in the Windows Operating System. We can now access it via
the Command Prompt or the UI products we installed with it (Shell and Workbench).

SAMPLE DATA:

User id followers

local_logu 220

astro_vj 120

lovely_nandhu 340

QUERIES:

mysql> create database instagram;


mysql> use instagram;

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

//CREATE
mysql> create table user_followers_list (user_id varchar (30), followers int);
//INSERT
mysql> insert into user_followers_list values("local_logu",220);
mysql> insert into user_followers_list values("astro_vj",120);
mysql> insert into user_followers_list values("lovely_nandhu",340);
mysql> select*from user_followers_list;
//CREATE TRIGGER
mysql> create trigger ins_sum before insert on user_followers_list for each row set
@sum=@sum+ new.followers;
mysql>set@sum=220+120+340;
mysql>select@sum as total;

OUTPUT:

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

XML DATABASE, TABLE CREATION, XQUERY FLWOR EXPRESSION


INSTALLATION PROCEDURE:
To perform Database and table creation using xml, software is not required to execute the code
instead can run using local host.
STEP 1: To run a xml code, select the xml file that need to be executed and right click it.
STEP 2: select the open with option in the list.
STEP 3: select the XML editor in the list and you will be displayed with the output of the selected
file.
XML DATABASE:
DBstu_detail.xml
<student_details>
<biodata>
<student>
<Reg_no>01</Reg_no>
<Student_Name>sara</Student_Name>
<DOB>09-01-2002</DOB>
<Gender>female</Gender>
<Department>MCA</Department>
</student>
<student>
<Reg_no>20</Reg_no>
<Student_Name>Deepak</Student_Name>
<DOB>21-09-2000</DOB>
<Gender>male</Gender>
<Department>MBA</Department>
</student>
</biodata>
</student_details>

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

OUTPUT:

TABLE CREATION:
Biodata.xml
<?xml version = "1.0"?>
<?xml-stylesheet type = "text/xsl" href = "stu_detail.xsl"?>
<biodata>
<student>
<Reg_no>01</Reg_no>
<Student_Name>sara</Student_Name>
<DOB>09-01-2002</DOB>
<Gender>female</Gender>
<Department>MCA</Department>
</student>
<student>
<Reg_no>20</Reg_no>
<Student_Name>Deepak</Student_Name>
<DOB>21-09-2000</DOB>
<Gender>male</Gender>

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

<Department>MBA</Department>
</student>
<student>
<Reg_no>43</Reg_no>
<Student_Name>samyuktha</Student_Name>
<DOB>07-12-2002</DOB>
<Gender>female</Gender>
<Department>physics</Department>
</student>
</biodata>
stu_detail.xsl:
<?xml version="1.0" encoding = "UTF-8"?>
<xsl:stylesheet version = "1.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
<xsl:template match = "/">
<html>
<body>
<h2>STUDENTS BIODATA</h2>
<table border="2">
<tr bgcolor="yellow">
<th>Reg_no</th>
<th>Student_Name</th>
<th>DOB</th>
<th>Gender</th>
<th>Department</th>
</tr>
<xsl:for-each select="biodata/student">
<tr bgcolor="cyan">
<td>
<xsl:value-of select="Reg_no"/>
</td>
<td>

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

<xsl:value-of select="Student_Name"/>
</td>
<td>
<xsl:value-of select="DOB"/>
</td>
<td>
<xsl:value-of select="Gender"/>
</td>
<td>
<xsl:value-of select="Department"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

OUTPUT:

XQUERY FLWOR EXPRESSION:

STEP 1: Visit the Microsoft SQL Server website to download the Developer Edition: SQL Server
Downloads
Run the downloaded installer.

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

Follow the installation wizard prompts:


• Choose the installation type (Bacis).
• Accept the license terms.
• Select the features you want to install (typically, you'd install the Database Engine
Services).
• Specify the instance configuration (default or named instance).
• Choose the authentication mode (Windows Authentication).
• Configure additional options if necessary.
Complete the installation process.
After installation, ensure that the SQL Server service is running.
.

STEP 2: Install Microsoft SQL Server Management Studio (SSMS)

1. Go to the Microsoft SQL Server Management Studio download page: SSMS Download

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

2. Select the latest version of SSMS.


3. Run the downloaded SSMS installer.
4. Follow the installation wizard prompts:
• Accept the license terms.
• Choose the installation location (or use the default).
• Select additional components if needed.
5. Complete the installation process.

STEP 3: Connect Microsoft SQL Server Management Studio with SQL Server

1. Open SQL Server Management Studio.


2. In the "Connect to Server" dialog, specify the Server type (Database Engine).
3. Enter the Server name (either the name or IP address of the SQL Server instance).
4. Choose the authentication method (Windows Authentication).
5. If using SQL Server Authentication, enter the appropriate credentials.
6. Click "Connect" to establish the connection to the SQL Server instance.
7. Click new query

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

SAMPLE DATA:

Id Name Age City

local _logu Loganathan 21 Devakottai

astro_vj Vijay 22 Thoothukudi

lovely-nandhu Shreenandhan 20 Trichy

XQUERY FLWOR EXPRESSION:

DECLARE @x xml
SET @x='
<social_media>
<instagram>
<user>
<id>astro_vj</id>
<name>Vijay</name>
<age>22</age>
<city>Thoothukudi</city>
</user>
<user>
<id>local_logu</id>
<name>Loganathan</name>
<age>22</age>
<city>Devakottai</city>
</user>
<user>
<id>lovely_nandhu</id>
<name>Shree Nandhan</name>

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

<age>22</age>
<city>Trichy</city>
</user>
</instagram>
</social_media>'
;

SELECT @x.query('
for $b in social_media/instagram/user
let $a := $b/id
let $p := $b/name
where $a="lovely_nandhu"
order by ($p)[1]
return $b
')

OUTPUT:

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

MOBILE DATABASE
INSTALLATION PROCEDURE:

STEP 1: Login MONGODB ATLAS with Email ID

STEP 2: Select the M0 Free database Server

STEP 3: Give the Cluster (or) Database name and proceed to Deployment the Server

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 4: A Window Pop up for Creating Username and password ,then click the “Create
Username”

STEP 5: After that MongoDb database were created and Click the “Connect” button

STEP 6: After that the window will popped out, then click the “Compass menu”

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

STEP 7: Download the “Mongo Db Compass”

STEP 8: After installation the Mongo Compass, copy the command string in system command
prompt and Enter the password then the Database were Connected.

STEP 9: Connect the Database with Mongodb Compass

STEP 10: Create a Database name and Collection name. Finally import the values in JSON Format.

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

SAMPLE DATA:

Id Name Present Days Absent Days On Duty Days


1 Nandhu 50 10 15
2 Loganathan 55 7 13
3 Vijay 65 8 2
4 Sobiya 68 7 0
5 Jerish 65 9 1
6 Saranya 68 7 0
7 Jayachandran 60 15 0
8 Harshavardhan 62 14 0

QUERIES:

[
{
"id": "1",
"Name": "Nandhu",
"Present_Days": "50",
"Absent_Days": "10",
"OnDuty_Days": "15"
},
{
"id": "2",
"Name": "Loganathan",
"Present_Days": "55",
"Absent_Days": "7",
"OnDuty_Days": "13"
},
{
"id": "3",
"Name": "Vijay",
"Present_Days": "65",
"Absent_Days": "8",
"OnDuty_Days": "2"
},
{
"id": "4",
"Name": "Sobiya",
"Present_Days": "68",
"Absent_Days": "7",
"OnDuty_Days": "0"
},
{
"id": "5",
"Name": "Jerish",
"Present_Days": "65",
"Absent_Days": "9",
"OnDuty_Days": "1"
},
{
"id": "6",
"Name": "Saranya",

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

"Present_Days": "68",
"Absent_Days": "7",
"OnDuty_Days": "0"
},
{
"id": "7",
"Name": "Jayachandran",
"Present_Days": "60",
"Absent_Days": "15",
"OnDuty_Days": "0"
},
{
"id": "8",
"Name": "Harshavardhan",
"Present_Days": "62",
"Absent_Days": "14",
"OnDuty_Days": "0"
}
]

OUTPUT:

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

HIVE DATATYPES, DATABASE OPERATIONS, PARTITIONING-HIVEQL

Downloaded by subathra devi ([email protected])


lOMoARcPSD|52618716

Downloaded by subathra devi ([email protected])

You might also like