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

GEOPOLITICAL

The document outlines a project on a Geopolitical Database Management System created by Abhishek Kumar for the School of Computer Science at Lovely Professional University. It includes sections on the introduction to DBMS, an ER diagram, normalization processes, SQL commands, and examples of table creation and data insertion for various countries and continents. The project aims to maintain accurate and updated information regarding geopolitical data globally.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views28 pages

GEOPOLITICAL

The document outlines a project on a Geopolitical Database Management System created by Abhishek Kumar for the School of Computer Science at Lovely Professional University. It includes sections on the introduction to DBMS, an ER diagram, normalization processes, SQL commands, and examples of table creation and data insertion for various countries and continents. The project aims to maintain accurate and updated information regarding geopolitical data globally.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 28

GEOPOLITICAL

DATABASE
Project
INT306

DATABASE MANAGEMENT SYSTEM

Submitted By :- Submitted To:-


ABHISHEK KUMAR Dr.Omdev
12115093
K21QT
TABLE OF CONTENTS

1. Declaration
2. Acknowledgement
3. Introduction
4. ER-Diagram
5. Normalization
6. Command uses in this project
7. Table Creation
8. PL\SQL Queries
9. Conclusion
Declaration
I hereby declare that the Project work entitled
“ GEOPOLITICAL DATABASE ” submitted to
School of Computer Science, Lovely Professional
University, Phagwara, Punjab is prepared by me.
All the coding and Implementation of the coding
performed are the results of my personal efforts.

ABHISHEK KUMAR

12115093

K21QT

RK21QTA36
Acknowledgement

I would like to express my special thanks of


gratitude to my teacher Dr. Omdev (26990) who
gave me the golden opportunity to do this
wonderful project of Database Management
System on “ GEOPOLITICAL DATABASE ”
Who also helped me in completing my project. I
came to know about so many new things I am
really thankful to him.

ABHISHEK KUMAR
12115093
K21QT
RK21QTA36
INTRODUCTION

A database management system (or DBMS) is essentially


nothing more than a computerized data-keeping system.
Users of the system are given facilities to perform several
kinds of operations on such a system for either
manipulating the data in the database or managing the
database structure itself.

A “ GEOPOLITICAL DATABASE ” holds the


information of the data related to the Continents, Countries,
and all the data related to them.
Below is a database that includes the Continents, Countries,
and their Capitals with Country codes (calling codes)
around the world.

These databases need to be maintained in order to


keep track of the ups and downs around the world
so, the information can be updated accordingly and
accurately.
ER – DIAGRAM: -
An ER model is typically implemented as a database. In a simple
relational database implementation, each row of a table represents one
instance of an entity type, and each field in a table represents an
attribute type. In a relational database a relationship between entities
is implemented by storing the PRIMARY KEY of one entity as a
pointer or "foreign key" in the table of another entity. There is a
tradition for ER/data models to be built at two or three levels of
abstraction. Note that the conceptual-logical-physical hierarchy below
is used in other kinds of specification and is different from the three-
schema approach to software engineering. While useful for
organizing data that can be represented by a relational structure, an
entity relationship diagram can't sufficiently represent semi-structured
or unstructured data, and an ER Diagram is unlikely to be helpful on
its own in integrating data into a pre- existing information system.
Cardinality notations define the attributes of the relationship between
the entities. Cardinalities can denote that an entity is optional.
Cardinality Defines the Numerical attributes of the relationship
between two entities or entity sets. Different types of cardinal
relationships are:
➢ One-to-One Relationships: One entity from entity set X can be associated
with at most one entity of entity set Y and vice versa.
➢ One-to-Many Relationships: One entity from entity set X can be associated
with multiple entities of entity set Y, but an entity from entity set Y can be
associated with at least one entity.
➢ Many to One Relationships: More than one entity from entity set X can be
associated with at most one entity of entity set Y. However, an entity from
entity set Y may or may not be associated with more than one entity from
entity set X.
➢ Many-to-Many Relationships: One entity from X can be associated with
more than one entity from Y and vice versa.

ENTITY: -

ATTRIBUTE: -

Relationship:-

MULTIVALUED ATTRIBUTES:-
ER DIAGRAM:-
*Normalization: -
• Normalization is a method to remove anomalies and bring
the database to a consistent state.
• First Normal Form - As per First Normal Form, no two Rows of
data must contain repeating group of information.
• Second Normal Form - No non-prime attribute is dependent on the
proper subset of any candidate key of the table.
• Third Normal Form - Transitive functional dependency of non-
prime attribute on any super key should be removed.
• In other words 3NF can be explained like ts: A table is in 3NF if it
is in 2NF and for each functional dependency X-> Y at least one of
the following conditions hold: X is a super key of table and Y is a
prime attribute of table
● Boyce-Codd Normal Form - It is an advance version of 3NF
that's why it is also referred as 3.5NF. BCNF is stricter than 3NF. A
table complies with BCNF if it is in 3NF and for every functional
dependency X->Y, X should be the super key of the table.

Functional dependencies: -
Functional dependency (FD) is a set c constraints between two
attributes in a relation. Functional dependency says that if two tuples
have same values for attributes A1, A2,..., An, then those two tuples
must have same values for attributes B1, B2, ..., Bn.
Various commands used in the project are:-
SELECT: This statement is used to select data from a
database. The data returned is stored in a result table,
called the result set.

INSERT: This statement in SQL is used to add


new data to your database.
CREATE: This command is used to create a stored
procedure. A stored procedure is a prepared SQL
code that you can save, so the code can be
reused over and over again.

PRIMARY KEY: This constraint uniquely identifies


each record in a table. Primary keys must contain
UNIQUE values, and cannot contain NULL values. A
table can have only ONE primary key; and in the
table, this primary key can consist of single or
multiple columns

FOREIGN KEY: A field (or collection of fields) in one


table, that refers to the PRIMARY KEY in another table.

NOT NULL: This constraint enforces a column to not


accept NULL values, which means that you cannot
insert or update a record without adding a value to
this field.

DEFAULT: This constraint is used to set a default


value for a column. The default value will be added to
all new records, if no other value is specified.
Table
Creation
Create table GeopoliticalDB1(
Country_code varchar(20),
Continent varchar(40) not null,
Country varchar(40) PRIMARY KEY,
Capital varchar(40)
);

Insertion in table
Insert into GeopoliticalDB1 VALUES('994','Asia','Azerbaijan','Baku');
Insert into GeopoliticalDB1 VALUES('374','Asia','Armenia','Yerevan');
Insert into GeopoliticalDB1 VALUES('93','Asia','Afghanistan','Kabul');
Insert into GeopoliticalDB1 VALUES('973','Asia','Bahrain','Manama');
Insert into GeopoliticalDB1 VALUES('880','Asia','Bangladesh','Dhaka');
Insert into GeopoliticalDB1 VALUES('975','Asia','Bhutan','Thimphu');
Insert into GeopoliticalDB1 VALUES('673','Asia','Brunei','Bandar Seri Begawan');
Insert into GeopoliticalDB1 VALUES('855','Asia','Cambodia','Phnom Penh');
Insert into GeopoliticalDB1 VALUES('86','Asia','China','Beijing');
Insert into GeopoliticalDB1 VALUES('995','Asia','Georgia','Tbilisi');
Insert into GeopoliticalDB1 VALUES('852','Asia','Hong Kong','City of Victoria');
Insert into GeopoliticalDB1 VALUES('91','Asia','India','New Delhi');
Insert into GeopoliticalDB1 VALUES('62','Asia','Indonesia','Jakarta');
Insert into GeopoliticalDB1 VALUES('98','Asia','Iran','Tehran');
Insert into GeopoliticalDB1 VALUES('964','Asia','Iraq','Baghdad');
Insert into GeopoliticalDB1 VALUES('972','Asia','Israel','Jerusalem');
Insert into GeopoliticalDB1 VALUES('81','Asia','Japan','Tokyo');
Insert into GeopoliticalDB1 VALUES('962','Asia','Jordan','Amman');
Insert into GeopoliticalDB1 VALUES('7','Asia','Kazakhstan','Astana');
Insert into GeopoliticalDB1 VALUES('965','Asia','Kuwait','Kuwait City');
Insert into GeopoliticalDB1 VALUES('996','Asia','Kyrgyzstan','Bishkek');
Insert into GeopoliticalDB1 VALUES('856','Asia','Laos','Vientiane');
Insert into GeopoliticalDB1 VALUES('961','Asia','Lebanon','Beirut');
Insert into GeopoliticalDB1 VALUES('853','Asia','Macau','');
Insert into GeopoliticalDB1 VALUES('60','Asia','Malaysia','Kuala Lumpur');
Insert into GeopoliticalDB1 VALUES('960','Asia','Maldives','Male');
Insert into GeopoliticalDB1 VALUES('976','Asia','Mongolia','Ulan Bator');
Insert into GeopoliticalDB1 VALUES('95','Asia','Myanmar','Nay Pyi Taw');
Insert into GeopoliticalDB1 VALUES('977','Asia','Nepal','Kathmandu');
Insert into GeopoliticalDB1 VALUES('850','Asia','North Korea','Pyongyang');
Insert into GeopoliticalDB1 VALUES('968','Asia','Oman','Muscat');
Insert into GeopoliticalDB1 VALUES('92','Asia','Pakistan','Islamabad');
Insert into GeopoliticalDB1 VALUES('970','Asia','Palestine','Ramallah');
Insert into GeopoliticalDB1 VALUES('63','Asia','Philippines','Manila');
Insert into GeopoliticalDB1 VALUES('974','Asia','Qatar','Doha');
Insert into GeopoliticalDB1 VALUES('966','Asia','Saudi Arabia','Riyadh');
Insert into GeopoliticalDB1 VALUES('65','Asia','Singapore','Singapore');
Insert into GeopoliticalDB1 VALUES('82','Asia','South Korea','Seoul');
Insert into GeopoliticalDB1 VALUES('94','Asia','Sri Lanka','Colombo');
Insert into GeopoliticalDB1 VALUES('963','Asia','Syria','Damascus');
Insert into GeopoliticalDB1 VALUES('886','Asia','Taiwan','Taipei');
Insert into GeopoliticalDB1 VALUES('992','Asia','Tajikistan','Dushanbe');
Insert into GeopoliticalDB1 VALUES('66','Asia','Thailand','Bangkok');
Insert into GeopoliticalDB1 VALUES('670','Asia','East Timor','Dili');
Insert into GeopoliticalDB1 VALUES('90','Asia','Turkey','Ankara');
Insert into GeopoliticalDB1 VALUES('993','Asia','Turkmenistan','Ashgabat');
Insert into GeopoliticalDB1 VALUES('971','Asia','United Arab Emirates','Abu Dhabi');
Insert into GeopoliticalDB1 VALUES('998','Asia','Uzbekistan','Tashkent');
Insert into GeopoliticalDB1 VALUES('84','Asia','Vietnam','Hanoi');
Insert into GeopoliticalDB1 VALUES('967','Asia','Yemen','Sanaa');

--Above mentioned Countries were the 'Asian' Countries.


Insert into GeopoliticalDB1 VALUES('213','Africa','Algeria','Algiers');
Insert into GeopoliticalDB1 VALUES('244','Africa','Angola','Luanda');
Insert into GeopoliticalDB1 VALUES('229','Africa','Benin','Porto Novo');
Insert into GeopoliticalDB1 VALUES('267','Africa','Botswana','Gaborone');
Insert into GeopoliticalDB1 VALUES('246','Africa','British Indian Ocean
Territory','Diego Garcia');
Insert into GeopoliticalDB1 VALUES('226','Africa','Burkina
Faso','Ouagadougou');
Insert into GeopoliticalDB1 VALUES('257','Africa','Burundi','Bujumbura');
Insert into GeopoliticalDB1 VALUES('237','Africa','Cameroon','Yaoundé');
Insert into GeopoliticalDB1 VALUES('238','Africa','Cape Verde','Praia');
Insert into GeopoliticalDB1 VALUES('236','Africa','Central African
Republic','Bangui');
Insert into GeopoliticalDB1 VALUES('235','Africa','Chad','N djamena');
Insert into GeopoliticalDB1 VALUES('269','Africa','Comoros','Moroni');
Insert into GeopoliticalDB1 VALUES('253','Africa','Djibouti','Djibouti');
Insert into GeopoliticalDB1 VALUES('243','Africa','DR Congo','Kinshasa');
Insert into GeopoliticalDB1 VALUES('20','Africa','Egypt','Cairo');
Insert into GeopoliticalDB1 VALUES('240','Africa','Equatorial
Guinea','Malabo');
Insert into GeopoliticalDB1 VALUES('291','Africa','Eritrea','Asmara');
Insert into GeopoliticalDB1 VALUES('268','Africa','Eswatini','Lobamba');
Insert into GeopoliticalDB1 VALUES('251','Africa','Ethiopia','Addis Ababa');
Insert into GeopoliticalDB1 VALUES('241','Africa','Gabon','Libreville');
Insert into GeopoliticalDB1 VALUES('220','Africa','Gambia','Banjul');
Insert into GeopoliticalDB1 VALUES('233','Africa','Ghana','Accra');
Insert into GeopoliticalDB1 VALUES('245','Africa','Guinea Bissau','Bissau');
Insert into GeopoliticalDB1 VALUES('225','Africa','Ivory
Coast','Yamoussoukro');
Insert into GeopoliticalDB1 VALUES('254','Africa','Kenya','Nairobi');
Insert into GeopoliticalDB1 VALUES('266','Africa','Lesotho','Maseru');
Insert into GeopoliticalDB1 VALUES('231','Africa','Liberia','Monrovia');
Insert into GeopoliticalDB1 VALUES('218','Africa','Libya','Tripoli');
Insert into GeopoliticalDB1
VALUES('261','Africa','Madagascar','Antananarivo');
Insert into GeopoliticalDB1 VALUES('265','Africa','Malawi','Lilongwe');
Insert into GeopoliticalDB1 VALUES('223','Africa','Mali','Bamako');
Insert into GeopoliticalDB1 VALUES('222','Africa','Mauritania','Nouakchott');
Insert into GeopoliticalDB1 VALUES('230','Africa','Mauritius','Port Louis');
Insert into GeopoliticalDB1 VALUES('262','Africa','Mayotte','Mamoudzou');
Insert into GeopoliticalDB1 VALUES('212','Africa','Morocco','Rabat');
Insert into GeopoliticalDB1 VALUES('258','Africa','Mozambique','Maputo');
Insert into GeopoliticalDB1 VALUES('264','Africa','Namibia','Windhoek');
Insert into GeopoliticalDB1 VALUES('227','Africa','Niger','Niamey');
Insert into GeopoliticalDB1 VALUES('234','Africa','Nigeria','Abuja');
Insert into GeopoliticalDB1 VALUES('242','Africa','Republic of the
Congo','Brazzaville');
Insert into GeopoliticalDB1 VALUES('262','Africa','Reunion','Saint Denis');
Insert into GeopoliticalDB1 VALUES('250','Africa','Rwanda','Kigali');
Insert into GeopoliticalDB1 VALUES('239','Africa','Sao Tome and
Principe','Sao Tome');
Insert into GeopoliticalDB1 VALUES('221','Africa','Senegal','Dakar');
Insert into GeopoliticalDB1 VALUES('248','Africa','Seychelles','Victoria');
Insert into GeopoliticalDB1 VALUES('232','Africa','Sierra Leone','Freetown');
Insert into GeopoliticalDB1 VALUES('252','Africa','Somalia','Mogadishu');
Insert into GeopoliticalDB1 VALUES('27','Africa','South Africa','Pretoria');
Insert into GeopoliticalDB1 VALUES('211','Africa','South Sudan','Juba');
Insert into GeopoliticalDB1 VALUES('249','Africa','Sudan','Khartoum');
Insert into GeopoliticalDB1 VALUES('255','Africa','Tanzania','Dodoma');
Insert into GeopoliticalDB1 VALUES('228','Africa','Togo','Lome');
Insert into GeopoliticalDB1 VALUES('216','Africa','Tunisia','Tunis');
Insert into GeopoliticalDB1 VALUES('256','Africa','Uganda','Kampala');
Insert into GeopoliticalDB1 VALUES('212','Africa','Western
Sahara','Laayoune');
Insert into GeopoliticalDB1 VALUES('261','Africa','Zambia','Lusaka');
Insert into GeopoliticalDB1 VALUES('263','Africa','Zimbabwe','Harare');

--Above mentioned Countries were the 'African'


Countries.
Insert into GeopoliticalDB1 VALUES('1-268','North America','Antigua and
Barbuda','Saint John’s');
Insert into GeopoliticalDB1 VALUES('1-242','North
America','Bahamas','Nassau');
Insert into GeopoliticalDB1 VALUES('1-246','North
America','Barbados','Bridgetown');
Insert into GeopoliticalDB1 VALUES('501','North
America','Belize','Belmopan');
Insert into GeopoliticalDB1 VALUES('1','North America','Canada','Ottawa');
Insert into GeopoliticalDB1 VALUES('506','North America','Costa Rica','San
José');
Insert into GeopoliticalDB1 VALUES('53','North America','Cuba','Havana');
Insert into GeopoliticalDB1 VALUES('45','North America','Denmark
(Greenland)','Nuuk');
Insert into GeopoliticalDB1 VALUES('1-767','North
America','Dominica','Roseau');
Insert into GeopoliticalDB1 VALUES('1-809, 1-829, 1-849','North
America','Dominican Republic','Santo Domingo');
Insert into GeopoliticalDB1 VALUES('503','North America','El Salvador','San
Salvador');
Insert into GeopoliticalDB1 VALUES('1-473','North America','Grenada','St.
George’s');
Insert into GeopoliticalDB1 VALUES('502','North
America','Guatemala','Guatemala City');
Insert into GeopoliticalDB1 VALUES('509','North America','Haiti','Port-au-
Prince');
Insert into GeopoliticalDB1 VALUES('504','North
America','Honduras','Tegucigalpa');
Insert into GeopoliticalDB1 VALUES('1-876','North
America','Jamaica','Kingston');
Insert into GeopoliticalDB1 VALUES('52','North America','Mexico','Mexico
City');
Insert into GeopoliticalDB1 VALUES('505','North
America','Nicaragua','Managua');
Insert into GeopoliticalDB1 VALUES('507','North America','Panama','Panama
City');
Insert into GeopoliticalDB1 VALUES('1-869','North America','Saint Kitts and
Nevis','Basseterre');
Insert into GeopoliticalDB1 VALUES('1-758','North
America','SaintLucia','Castries');
Insert into GeopoliticalDB1 VALUES('1-784','North America','Saint Vincent
and the Grenadines','Kingstown');
Insert into GeopoliticalDB1 VALUES('1-868','North America','Trinidad and
Tobago','Port of Spain');
Insert into GeopoliticalDB1 VALUES('1','North America','United
States','Washington D.C.');

--Above mentioned Countries were the 'North American'


Countries.
Insert into GeopoliticalDB1 VALUES('355','Europe','Albania','Tirana');
Insert into GeopoliticalDB1 VALUES('376','Europe','Andorra','Andorra la
Vella');
Insert into GeopoliticalDB1 VALUES('43','Europe','Austria','Vienna');
Insert into GeopoliticalDB1 VALUES('375','Europe','Belarus','Minsk');
Insert into GeopoliticalDB1 VALUES('32','Europe','Belgium','Brussels');
Insert into GeopoliticalDB1 VALUES('387','Europe','Bosnia and
Herzegovina','Sarajevo');
Insert into GeopoliticalDB1 VALUES('359','Europe','Bulgaria','Sofia');
Insert into GeopoliticalDB1 VALUES('385','Europe','Croatia','Zagreb');
Insert into GeopoliticalDB1 VALUES('420','Europe','Czechia','Prague');
Insert into GeopoliticalDB1 VALUES('45','Europe','Denmark','Copenhagen');
Insert into GeopoliticalDB1 VALUES('372','Europe','Estonia','Tallinn');
Insert into GeopoliticalDB1 VALUES('358','Europe','Finland','Helsinki');
Insert into GeopoliticalDB1 VALUES('33','Europe','France','Paris');
Insert into GeopoliticalDB1 VALUES('49','Europe','Germany','Berlin');
Insert into GeopoliticalDB1 VALUES('30','Europe','Greece','Athens');
Insert into GeopoliticalDB1 VALUES('36','Europe','Hungary','Budapest');
Insert into GeopoliticalDB1 VALUES('354','Europe','Iceland','Reykjavik');
Insert into GeopoliticalDB1 VALUES('353','Europe','Ireland','Dublin');
Insert into GeopoliticalDB1 VALUES('39','Europe','Italy','Rome');
Insert into GeopoliticalDB1 VALUES('371','Europe','Latvia','Riga');
Insert into GeopoliticalDB1 VALUES('423','Europe','Liechtenstein','Vaduz');
Insert into GeopoliticalDB1 VALUES('370','Europe','Lithuania','Vilnius');
Insert into GeopoliticalDB1
VALUES('352','Europe','Luxembourg','Luxembourg');
Insert into GeopoliticalDB1 VALUES('356','Europe','Malta','Valletta');
Insert into GeopoliticalDB1 VALUES('373','Europe','Moldova','Chisinau');
Insert into GeopoliticalDB1 VALUES('377','Europe','Monaco','Monaco');
Insert into GeopoliticalDB1 VALUES('382','Europe','Montenegro','Podgorica');
Insert into GeopoliticalDB1 VALUES('31','Europe','Netherlands','Amsterdam
Haag');
Insert into GeopoliticalDB1 VALUES('389','Europe','North
Macedonia','Skopje');
Insert into GeopoliticalDB1 VALUES('47','Europe','Norway','Oslo');
Insert into GeopoliticalDB1 VALUES('48','Europe','Poland','Warsaw');
Insert into GeopoliticalDB1 VALUES('351','Europe','Portugal','Lisbon');
Insert into GeopoliticalDB1 VALUES('40','Europe','Romania','Bucharest');
Insert into GeopoliticalDB1 VALUES('7','Europe','Russia','Moscow');
Insert into GeopoliticalDB1 VALUES('378','Europe','San Marino','San
Marino');
Insert into GeopoliticalDB1 VALUES('381','Europe','Serbia','Belgrade');
Insert into GeopoliticalDB1 VALUES('421','Europe','Slovakia','Bratislava');
Insert into GeopoliticalDB1 VALUES('386','Europe','Slovenia','Ljubljana');
Insert into GeopoliticalDB1 VALUES('34','Europe','Spain','Madrid');
Insert into GeopoliticalDB1 VALUES('46','Europe','Sweden','Stockholm');
Insert into GeopoliticalDB1 VALUES('41','Europe','Switzerland','Bern');
Insert into GeopoliticalDB1 VALUES('380','Europe','Ukraine','Kiev');
Insert into GeopoliticalDB1 VALUES('44','Europe','United
Kingdom','London');

--Above mentioned Countries were the 'European'


Countries.
Insert into GeopoliticalDB1 VALUES('61','Australia','Australia','Canberra');
Insert into GeopoliticalDB1 VALUES('691','Australia','Micronesia','Palikir');
Insert into GeopoliticalDB1 VALUES('679','Australia','Fiji','Suva');
Insert into GeopoliticalDB1 VALUES('686','Australia','Kiribati','South
Tarawa');
Insert into GeopoliticalDB1 VALUES('692','Australia','Marshall
Islands','Majuro');
Insert into GeopoliticalDB1 VALUES('674','Australia','Nauru','Yaren');
Insert into GeopoliticalDB1 VALUES('64','Australia','New
Zealand','Wellington');
Insert into GeopoliticalDB1 VALUES('680','Australia','Palau','Ngerulmud');
Insert into GeopoliticalDB1 VALUES('675','Australia','Papua New
Guinea','Port Moresby');
Insert into GeopoliticalDB1 VALUES('685','Australia','Samoa','Apia');
Insert into GeopoliticalDB1 VALUES('677','Australia','Solomon
Islands','Honiara');
Insert into GeopoliticalDB1 VALUES('676','Australia','Tonga','Nukuʻalofa');
Insert into GeopoliticalDB1 VALUES('688','Australia','Tuvalu','Funafuti');
Insert into GeopoliticalDB1 VALUES('678 ','Australia','Vanuatu','Port Vila');

--Above mentioned Countries were the 'Australian'


Countries.

Insert into GeopoliticalDB1 VALUES('54','South America','Argentina','Buenos


Aires');
Insert into GeopoliticalDB1 VALUES('591','South America','Bolivia','La Paz
Sucre');
Insert into GeopoliticalDB1 VALUES('55','South America','Brazil','Brasilia');
Insert into GeopoliticalDB1 VALUES('56','South America','Chile','Santiago');
Insert into GeopoliticalDB1 VALUES('57','South
America','Colombia','Bogota');
Insert into GeopoliticalDB1 VALUES('593','South America','Ecuador','Quito');
Insert into GeopoliticalDB1 VALUES('33','South America','France (French
Guiana)','Cayenne');
Insert into GeopoliticalDB1 VALUES('592','South
America','Guyana','Georgetown');
Insert into GeopoliticalDB1 VALUES('595','South
America','Paraguay','Asuncion');
Insert into GeopoliticalDB1 VALUES('51','South America','Peru','Lima');
Insert into GeopoliticalDB1 VALUES('597','South
America','Suriname','Paramaribo');
Insert into GeopoliticalDB1 VALUES('598','South
America','Uruguay','Montevideo');
Insert into GeopoliticalDB1 VALUES('58','South
America','Venezuela','Caracas');

--Above mentioned Countries were the 'South American'


Countries.

PL/SQL Queries

PL/SQL Stands for procedural language


extension to SQL. In a procedure, the role of
the subprogram is to perform a particular
task and it is a unit module of a program. It
combined to form larger programs. A
subprogram can be involved by another
program which is called the calling program.
PL/SQL provides a block structure of
executable unit code. It Provides procedural
constructs, for example, in control structure
includes loops, conditional statement and
variable, constant, and data type.

 To display the table

Selec*from GeopoliticalD1;

 To Sort the table in Ascending


order Select * from
GeopoliticalDB1
ORDER BY Continent ASC;

 To display the data using the first alphabet, last


alphabet, or even using a middle name.

select * from GeopoliticalDB1 where Country like 'A%';


select * from GeopoliticalDB where Country like '%h';

select * from GeopoliticalDB where Country like '%us%';

select * from GeopoliticalDB where Country like '_n%'

 Use of cursor, User Input and Exception


Declare
a varchar (20);
b varchar (20);
c varchar (20);
d varchar (20);
CURSOR Cur(e varchar) is select Country, Country_code, Capital
from GeopoliticalDB1
Where
Continent = e;
BEGIN
d :=:Enter_Conti
nent; Open
Cur(d);
LOOP
Fetch Cur into a,b,c;
exit when Cur%NOTFOUND;
dbms_output.Put_line(a ||CHR(9)|| b ||
CHR(9)|| c);
End LOOP;
Close
Cur;
END;
 Finding the Capital of any Country using user Input

Declare
x
varchar(
20);

y
varchar(
20);
begin
x := :Enter_Countery_n
ame; select Capital
INTO y
From
GeopoliticalDB1
Where Country
= x;
dbms_output.put_line('Capital of '|| x|| ' :
'|| y); Exception
When no_data_found then
dbms_output.put_line('Country name does not
exist!');
When others then
dbms_output.put_line('Something went
wrong);
end;
 Finding country based on Country_code. Using
Exception and user Input.
declare
x
varchar(
20); y
varchar(
20);
begin
x := :Enter_Countery_c
ode; select
Country_code INTO y
From GeopoliticalDB
Where Country = x;
dbms_output.put_line('Country code of '|| x|| ' :
'|| y); Exception
When no_data_found then
dbms_output.put_line('Country name does not
exist!');
When others then
dbms_output.put_line('Something went
wrong);
end;
Conclusion

The purpose of this project and the research was to


Knowing, how in the real-world use Database is
handy. Through this project, I have gained more
knowledge about how Database Management
works and learned about the Commands and
Queries used to maintain the Database.

You might also like