File: /media/chandresh/Chandresh/Co .E.C.O. Sem 6/DD/Fragmentation Page 1 of 4

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

File: /media/chandresh/Chandresh/Co….E.C.O.

Sem 6/DD/Fragmentation Page 1 of 4

chandresh@chandresh-VirtualBox:~$ mysql -u root -p


Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 7
Server version: 10.0.23-MariaDB-2 Ubuntu 16.04

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;


+--------------------+
| Database |
+--------------------+
| Hospital_11co35 |
| information_schema |
| mysql |
| performance_schema |
+--------------------+
4 rows in set (0.04 sec)

MariaDB [(none)]> use Hospital_11co35;

Database changed
MariaDB [Hospital_11co35]> show tables;
+---------------------------+
| Tables_in_Hospital_11co35 |
+---------------------------+
| Bill |
| Branch |
| Doctor |
| Employee |
| Patient |
| Pharmacy |
| Test |
+---------------------------+
7 rows in set (0.00 sec)

####################--------Horizontal Fragmentation----------#######################

MariaDB [Hospital_11co35]> select * from Branch;


+-----------+--------+------------+-------------+-----------+-------------+
| branch_id | doc_id | patient_id | branch_name | address | contact_no |
+-----------+--------+------------+-------------+-----------+-------------+
| 91 | 1 | 21 | B1 | Dahisar | -28961956 |
| 92 | 2 | 22 | B2 | Kandivli | -28961957 |
| 93 | 3 | 23 | B3 | Khar | -28961958 |
| 94 | 4 | 24 | B4 | Andheri | -28961959 |
| 95 | 5 | 25 | B5 | Malad | -28961960 |
| 96 | 6 | 26 | B6 | Glasgow | -789456079 |
| 97 | 7 | 27 | B7 | Nashville | -4455667686 |
| 98 | 8 | 28 | B8 | Ashokvan | -28961961 |
| 99 | 9 | 29 | B9 | Virar | -28961962 |
| 100 | 10 | 30 | B10 | Kurla | -28961963 |
| 101 | 11 | 31 | B11 | Santacruz | -28961964 |
| 102 | 12 | 32 | B12 | Vashi | -28961965 |
+-----------+--------+------------+-------------+-----------+-------------+
12 rows in set (0.02 sec)

MariaDB [Hospital_11co35]> create table Branch11 as (select * from Branch where address="Glassgow"
OR address="Nashville");
Query OK, 1 row affected (0.09 sec)
Records: 1 Duplicates: 0 Warnings: 0

MariaDB [Hospital_11co35]> select * from Branch11;


+-----------+--------+------------+-------------+-----------+-------------+
| branch_id | doc_id | patient_id | branch_name | address | contact_no |
+-----------+--------+------------+-------------+-----------+-------------+
| 97 | 7 | 27 | B7 | Nashville | -4455667686 |
+-----------+--------+------------+-------------+-----------+-------------+
1 row in set (0.00 sec)
File: /media/chandresh/Chandresh/Co….E.C.O. Sem 6/DD/Fragmentation Page 2 of 4

MariaDB [Hospital_11co35]> select * from Branch;


+-----------+--------+------------+-------------+-----------+-------------+
| branch_id | doc_id | patient_id | branch_name | address | contact_no |
+-----------+--------+------------+-------------+-----------+-------------+
| 91 | 1 | 21 | B1 | Dahisar | -28961956 |
| 92 | 2 | 22 | B2 | Kandivli | -28961957 |
| 93 | 3 | 23 | B3 | Khar | -28961958 |
| 94 | 4 | 24 | B4 | Andheri | -28961959 |
| 95 | 5 | 25 | B5 | Malad | -28961960 |
| 96 | 6 | 26 | B6 | Glasgow | -789456079 |
| 97 | 7 | 27 | B7 | Nashville | -4455667686 |
| 98 | 8 | 28 | B8 | Ashokvan | -28961961 |
| 99 | 9 | 29 | B9 | Virar | -28961962 |
| 100 | 10 | 30 | B10 | Kurla | -28961963 |
| 101 | 11 | 31 | B11 | Santacruz | -28961964 |
| 102 | 12 | 32 | B12 | Vashi | -28961965 |
+-----------+--------+------------+-------------+-----------+-------------+
12 rows in set (0.00 sec)

####################----------Vertical Fragmentation----------#######################

MariaDB [Hospital_11co35]> create table BranchInfo as (select branch_name,address from Branch);


Query OK, 12 rows affected (0.04 sec)
Records: 12 Duplicates: 0 Warnings: 0

MariaDB [Hospital_11co35]> select * from BranchInfo;


+-------------+-----------+
| branch_name | address |
+-------------+-----------+
| B1 | Dahisar |
| B2 | Kandivli |
| B3 | Khar |
| B4 | Andheri |
| B5 | Malad |
| B6 | Glasgow |
| B7 | Nashville |
| B8 | Ashokvan |
| B9 | Virar |
| B10 | Kurla |
| B11 | Santacruz |
| B12 | Vashi |
+-------------+-----------+
12 rows in set (0.00 sec)

MariaDB [Hospital_11co35]> select * from Branch;


+-----------+--------+------------+-------------+-----------+-------------+
| branch_id | doc_id | patient_id | branch_name | address | contact_no |
+-----------+--------+------------+-------------+-----------+-------------+
| 91 | 1 | 21 | B1 | Dahisar | -28961956 |
| 92 | 2 | 22 | B2 | Kandivli | -28961957 |
| 93 | 3 | 23 | B3 | Khar | -28961958 |
| 94 | 4 | 24 | B4 | Andheri | -28961959 |
| 95 | 5 | 25 | B5 | Malad | -28961960 |
| 96 | 6 | 26 | B6 | Glasgow | -789456079 |
| 97 | 7 | 27 | B7 | Nashville | -4455667686 |
| 98 | 8 | 28 | B8 | Ashokvan | -28961961 |
| 99 | 9 | 29 | B9 | Virar | -28961962 |
| 100 | 10 | 30 | B10 | Kurla | -28961963 |
| 101 | 11 | 31 | B11 | Santacruz | -28961964 |
| 102 | 12 | 32 | B12 | Vashi | -28961965 |
+-----------+--------+------------+-------------+-----------+-------------+
12 rows in set (0.00 sec)

####################-----------Dry Fragmentation-----------#######################

MariaDB [Hospital_11co35]> select *from Pharmacy;


+------------+------------+-------------+------+------+---------+
| patient_id | buy_date | particulars | rate | qty | ammount |
+------------+------------+-------------+------+------+---------+
| 21 | 2015-06-23 | Tablets | 113 | 1 | 113 |
| 22 | 2015-06-12 | Glucose | 100 | 5 | 500 |
| 23 | 2015-06-22 | Tubes | 55 | 5 | 275 |
File: /media/chandresh/Chandresh/Co….E.C.O. Sem 6/DD/Fragmentation Page 3 of 4

| 24 | 2015-08-13 | Blood | 256 | 2 | 512 |


| 25 | 2015-09-04 | Tablets | 156 | 3 | 469 |
| 26 | 2015-09-24 | Tablets | 110 | 5 | 550 |
| 27 | 2016-01-15 | Injections | 516 | 4 | 2064 |
| 28 | 2015-10-05 | Creams | 152 | 6 | 912 |
| 29 | 2015-10-17 | Glucose | 100 | 2 | 200 |
| 30 | 2015-10-28 | Tablets | 50 | 4 | 200 |
| 31 | 2015-11-10 | Tablets | 92 | 3 | 276 |
| 32 | 2015-11-25 | Injections | 215 | 2 | 430 |
+------------+------------+-------------+------+------+---------+
12 rows in set (0.00 sec)

MariaDB [Hospital_11co35]> create table ammount_info as (select * from Pharmacy where ammount<500);
Query OK, 7 rows affected (0.05 sec)
Records: 7 Duplicates: 0 Warnings: 0

MariaDB [Hospital_11co35]> select *from ammount_info;


+------------+------------+-------------+------+------+---------+
| patient_id | buy_date | particulars | rate | qty | ammount |
+------------+------------+-------------+------+------+---------+
| 21 | 2015-06-23 | Tablets | 113 | 1 | 113 |
| 23 | 2015-06-22 | Tubes | 55 | 5 | 275 |
| 25 | 2015-09-04 | Tablets | 156 | 3 | 469 |
| 29 | 2015-10-17 | Glucose | 100 | 2 | 200 |
| 30 | 2015-10-28 | Tablets | 50 | 4 | 200 |
| 31 | 2015-11-10 | Tablets | 92 | 3 | 276 |
| 32 | 2015-11-25 | Injections | 215 | 2 | 430 |
+------------+------------+-------------+------+------+---------+
7 rows in set (0.00 sec)

####################-----------Hybrid Fragmentation-----------#######################

MariaDB [Hospital_11co35]> select * from Pharmacy;


+------------+------------+-------------+------+------+---------+
| patient_id | buy_date | particulars | rate | qty | ammount |
+------------+------------+-------------+------+------+---------+
| 21 | 2015-06-23 | Tablets | 113 | 1 | 113 |
| 22 | 2015-06-12 | Glucose | 100 | 5 | 500 |
| 23 | 2015-06-22 | Tubes | 55 | 5 | 275 |
| 24 | 2015-08-13 | Blood | 256 | 2 | 512 |
| 25 | 2015-09-04 | Tablets | 156 | 3 | 469 |
| 26 | 2015-09-24 | Tablets | 110 | 5 | 550 |
| 27 | 2016-01-15 | Injections | 516 | 4 | 2064 |
| 28 | 2015-10-05 | Creams | 152 | 6 | 912 |
| 29 | 2015-10-17 | Glucose | 100 | 2 | 200 |
| 30 | 2015-10-28 | Tablets | 50 | 4 | 200 |
| 31 | 2015-11-10 | Tablets | 92 | 3 | 276 |
| 32 | 2015-11-25 | Injections | 215 | 2 | 430 |
+------------+------------+-------------+------+------+---------+
12 rows in set (0.00 sec)

MariaDB [Hospital_11co35]> create table Hybrid_info as(select particulars,rate,qty from Pharmacy


where ammount<500 and particulars="Tablets");
Query OK, 4 rows affected (0.04 sec)
Records: 4 Duplicates: 0 Warnings: 0

MariaDB [Hospital_11co35]> show tables;


+---------------------------+
| Tables_in_Hospital_11co35 |
+---------------------------+
| Bill |
| Branch |
| Doctor |
| Employee |
| Hybrid_info |
| Patient |
| Pharmacy |
| Test |
+---------------------------+
8 rows in set (0.00 sec)

MariaDB [Hospital_11co35]> select * from Hybrid_info;


File: /media/chandresh/Chandresh/Co….E.C.O. Sem 6/DD/Fragmentation Page 4 of 4

+-------------+------+------+
| particulars | rate | qty |
+-------------+------+------+
| Tablets | 113 | 1 |
| Tablets | 156 | 3 |
| Tablets | 50 | 4 |
| Tablets | 92 | 3 |
+-------------+------+------+
4 rows in set (0.00 sec)

You might also like