There is a need for a well-maintained database for the proper operation of every organization. Databases used to be standardized in nature in the modern past. However, companies tend to be diversified across the globe with the rise in globalization. Instead of a central database, they may elect to distribute data over local servers. Thus, the idea of Distributed Databases has arrived.
An overview of Databases and Database Management Systems (DBMS) is given in this chapter. An ordered set of associated data in a database. A DBMS is a package of tools for operating on a database. In our tutorial called "Learn DBMS," a detailed study of DBMS is available. We review the key concepts in this chapter so that the analysis of DDBMS can be carried out with ease. Database schemas, types of databases, and operations on databases are the three subjects covered.
A database is an ordered collection that is built for a particular purpose of related data. A database may be structured as a list of many tables, where a table represents an element or entity of the real world. Each table has several distinct fields representing the entity's characteristic features.
For examplea company database may include tables for projects, employees, departments, products and financial records. The fields in the Employee table may be Name, Company_Id, Date_of_Joining, and so forth.
A system for database management is a collection of software that allows a database to be generated and maintained. DBMS is available as a software package that makes it easier to describe, create, manipulate and share information in a database. The definition of a database requires a description of the database 's structure. Database construction requires the actual storage in any storage medium of the data. Manipulation refers to the retrieval of database information, the updating of databases and the production of reports. Data exchange facilitates the access to data between different users or programs.Examples of DBMS Application Areas
A database schema is a database description that is defined during the design of the database and is subject to infrequent alterations. The organization of the data, the relationships between them, and the constraints associated with them are described.
Via the three-schema architecture or ANSISPARC architecture, databases are also represented. The purpose of this architecture is to distinguish the physical database from the user application. The three levels are
There are four types of DBMS.Hierarchical DBMS
The relationships between data in the database are defined in hierarchical DBMS, so that one data entity exists as a subordinate of another. The data elements have relationships between parent and child and are modelled using the data structure "tree." It's really easy and simple.Network DBMS
In one where the relationships between data in the database are of type many-to-many in the context of a network , Network DBMS. Owing to the presence of several many-to-many relationships, the structure is usually complicated. The network DBMS is modelled using the structure of "graph" files.
For example − A Student Relation −Relational DBMS
Object-oriented DBMS comes from the object-oriented programming paradigm model. They are useful in representing both stable data as stored in databases and transient data as found in programmes that execute them. Small, reusable items called objects are used by them. Each object contains a part of the data and a series of operations that work on the information. Instead of being stored in relational table models, the object and its attributes are accessed via pointers.
For example − A simplified Bank Account object-oriented database −Distributed DBMS
A distributed database is a set of interconnected databases distributed over a computer network or over the internet. The distributed database is operated by a Distributed Database Management System (DDBMS) and offers mechanisms to make the databases accessible for users. Data is deliberately distributed among different nodes in these systems, so that all the organization's computing resources can be used optimallyOperations on DBMS
Create, Retrieve, Update and Delete are the four basic operations on a database.
Example − SQL command to create a student table −
CREATE TABLE STUDENT ( ROLL INTEGER PRIMARY KEY, NAME VARCHAR2(25), YEAR INTEGER, STREAM VARCHAR2(10) );
Example SQL command to insert a single tuple into the student table −
INSERT INTO STUDENT ( ROLL, NAME, YEAR, STREAM) VALUES ( 1, 'ANKIT JHA', 1, 'COMPUTER SCIENCE');
Example: The following SQL query must be performed to retrieve the names of all Computer Science students.
SELECT NAME FROM STUDENT WHERE STREAM = 'COMPUTER SCIENCE';
SQL command to change the stream from Electronics to Electronics and Communications, for example.
UPDATE STUDENT SET STREAM = 'ELECTRONICS AND COMMUNICATIONS' WHERE STREAM = 'ELECTRONICS';
Example − We use the following SQL command to add a new field or column, say address to the Student table, −
ALTER TABLE STUDENT ADD ( ADDRESS VARCHAR2(50) );
DELETE information stored or removed as a whole from a table-Deleting unique data requires removing selected rows from the table that meet certain conditions.
For example, we use the SQL command to delete all students who are currently in their 4th year when they pass out.
DELETE FROM STUDENT WHERE YEAR = 4;
Example − To remove the student table completely, the SQL command used is −
DROP TABLE STUDENT;