Professional Documents
Culture Documents
Fairfield Institute of Management and Technology Lab File Information System Management
Fairfield Institute of Management and Technology Lab File Information System Management
LAB FILE
Submitted
To: Submitted By:
Mr. Raj Kumar
Garg Student Name: JOJAF MASSY
Asst.Professor Enrol. No.
- 00451488819
ITDepartment B.Com. Sem.
-V
TABLE OF CONTENTS
• Number of allowed users. While a DBMS can only accept one user at a time, an
RDBMS can operate with multiple users.
• Hardware and software requirements. A DBMS needs less software and hardware
than an RDBMS.
• Amount of data. RDBMSes can handle any amount of data, from small to large,
while a DBMS can only manage small amounts.
• Database structure. In a DBMS, data is kept in a hierarchical form, whereas an
RDBMS utilizes a table where the headers are used as column names and the rows
contain the corresponding values.
• ACID implementation. DBMSes do not use the atomicity, consistency, isolation and
durability (ACID) model for storing data. On the other hand, RDBMSes base the
structure of their data on the ACID model to ensure consistency
• Distributed databases. While an RDBMS offers complete support for distributed
databases, a DBMS will not provide support.
• Types of programs managed. While an RDBMS helps manage the relationships
between its incorporated tables of data, a DBMS focuses on maintaining databases
that are present within the computer network and system hard disks.
• Support of database normalization. An RDBMS can be normalized, but a DBMS
cannot.
FEATURES OF RELATIONAL DATABASE MANAGEMENT
SYSTEMS
• Elements of the relational database management system that overarch the basic
relational database are so intrinsic to operations that it is hard to dissociate the two in
practice.
• The most basic RDBMS functions are related to create, read, update and delete
operations -- collectively known as CRUD. They form the foundation of a well-
organized system that promotes consistent treatment of data.
• The RDBMS typically provides data dictionaries and metadata collections that are
useful in data handling. These programmatically support well-defined data structures
and relationships. Data storage management is a common capability of the RDBMS,
and this has come to be defined by data objects that range from binary large object --
or blob -- strings to stored procedures. Data objects like this extend the scope of basic
relational database operations and can be handled in a variety of ways in different
RDBMSes.
• The most common means of data access for the RDBMS is SQL. Its main language
components comprise data manipulation language and data definition language
statements. Extensions are available for development efforts that pair SQL use with
common programming languages, such as the Common Business-Oriented Language
(COBOL), Java and .NET.
• RDBMSes use complex algorithms that support multiple concurrent user access to the
database while maintaining data integrity. Security management, which enforces
policy-based access, is yet another overlay service that the RDBMS provides for the
basic database as it is used in enterprise settings.
• RDBMSes support the work of database administrators (DBAs) who must manage
and monitor database activity. Utilities help automate data loading and database
backup. RDBMSes manage log files that track system performance based on selected
operational parameters. This enables measurement of database usage, capacity and
performance, particularly query performance. RDBMSes provide graphical interfaces
that help DBAs visualize database activity.
• While not limited solely to the RDBMS, ACID compliance is an attribute of relational
technology that has proved important in enterprise computing. These capabilities have
particularly suited RDBMSes for handling business transactions.
• As RDBMSes have matured, they have achieved increasingly higher levels of query
optimization, and they have become key parts of reporting, analytics and data
warehousing applications for businesses as well. RDBMSes are intrinsic to operations
of a variety of enterprise applications and are at the center of most master data
management systems.
How RDBMS works
As mentioned before, an RDBMS will store data in the form of a table. Each system will
have varying numbers of tables with each table possessing its own unique primary key. The
primary key is then used to identify each table.
Within the table are rows and columns. The rows are known as records or horizontal
entities; they contain the information for the individual entry. The columns are known as
Before creating these tables, the RDBMS must check the following
constraints:
• Primary keys - this identifies each row in the table. One table can only contain one
primary key. The key must be unique and without null values.
• Foreign keys - this is used to link two tables. The foreign key is kept in one table and
refers to the primary key associated with another table.
• Not null - this ensures that every column does not have a null value, such as an empty
cell.
• Check - this confirms that each entry in a column or row satisfies a precise condition
and that every column holds unique data. • Data integrity - the integrity of the data
must be confirmed before the data is created.
Assuring the integrity of data includes several specific tests, including entity, domain,
referential and user-defined integrity. Entity integrity confirms that the rows are not
duplicated in the table. Domain integrity makes sure that data is entered into the table based
on specific conditions, such as file format or range of values. Referential integrity ensures
that any row that is re-linked to a different table cannot be deleted. Finally, user-defined
integrity confirms that the table will satisfy all user-defined conditions.
SQL INTRODUCTION
SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
SQL became a standard of the American National Standards Institute (ANSI) in 1986, and of
the International Organization for Standardization (ISO) in 1987.
Structure Query Language(SQL) is a database query language used for storing and managing
data in Relational DBMS. SQL was the first commercial language introduced for E.F Codd's
Relational model of database. Today almost all RDBMS(MySql, Oracle, Infomix, Sybase, MS
Access) use SQL as the standard database query language. SQL is used to perform all types of
SQL Command
SQL defines following ways to manipulate data stored in an RDBMS.
COMMAND DESCRIPTION
Create To create new table or database
Alter For alteration
Truncate Delete data from table
Drop To drop a table
Rename To rename a table
• All the command of DDL are auto-committed that means it permanently save all the
changes in the database.
b. DROP: It is used to delete both the structure and record stored in the table.
Syntax:
DROP TABLE table_name;
Example
DROP TABLE EMPLOYEE;
c. ALTER: It is used to alter the structure of the database. This change could be either
to modify the characteristics of an existing attribute or probably to add a new
attribute.
Syntax:
To add a new column in the table:
ALTER TABLE table_name ADD column_name COLUMN-definition;
To modify existing column in the table:
ALTER TABLE table_name MODIFY(column_definitions. .. );
EXAMPLE
ALTER TABLE STU_DETAILS ADD(ADDRESS VARCHAR2(20));
ALTER TABLE STU_DETAILS MODIFY (NAME VARCHAR2(20));
d. TRUNCATE: It is used to delete all the rows from the table and free the space
containing the table.
Syntax:
TRUNCATE TABLE table_name; Example:
TRUNCATE TABLE EMPLOYEE;
DML COMMAND IN RDBMS
• DML commands are used to modify the database. It is responsible for all
form of changes in the database.
• The command of DML is not auto-committed that means it can't permanently save all
the changes in the database. They can be rollback.
For example:
1. INSERT INTO javatpoint (Author, Subject) VALUES ("Sonoo", "DBMS");
b. UPDATE: This command is used to update or modify the value of a column in the table.
Syntax:
1. UPDATE table_name SET [column_name1= value1,...column_nameN =
valueN] [W HERE CONDITION] For example:
1. UPDATE students
2. SET User_Name = 'Sonoo'
3. WHERE Student_Id = '3'
c. DELETE: It is used to remove one or more row from a table.
Syntax:
1. DELETE FROM table_name [WHERE condition]; For example:
1. DELETE FROM javatpoint
2. WHERE Author="Sonoo";
1. SQL
CREATE TABLE COMMAND IN
SYNTAX:
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype, ....
);
2. SQL
SYNTAX:
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
3. SQL
SYNTAX:
4. SQL
SELECT TABLE COMMAND IN
SYNTAX:
6. SQL
SYNTAX:
UPDATE TABLE COMMAND IN
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
7.
SYNTAX:
SYNTAX:
DELETE FROM table_name WHERE condition;
9.
SYNTAX:
10.
Memory Table memory space is not free if Drop command frees the memory space.
5 Space all records are deleted using
Delete Command.
Problem DELETE command may face DROP Command may cause memory
6 shortage of memory. fragmentation.
Interaction SQL directly interacts with PL/SQL does not directly interacts with
6 database server. database server.
Objective SQL is used to write queries, PL/SQL is used to write program blocks,
8 create and execute DDL and functions, procedures, triggers and
DML statments. packages.
This constraint defines a column or combination of columns which uniquely identifies each
row in the table
This constraint identifies any column referencing the PRIMARY KEY in another table. It
establishes a relationship between two columns in the same table or between different
tables. For a column to be defined as a Foreign Key, it should be a defined as a Primary
Key in the table which it is referring. One or more columns can be defined as Foreign key.
Syntax to define a Foreign key
[CONSTRAINT constraint_name]
FOREIGN KEY(column_name)
REFERENCES referenced_table_name(column_name);
EXAMPLE: To create an employee table with Unique key, the query would be like,
CREATE TABLE order_items
( order_id number(5) , product_id
number(5), product_name
char(20), supplier_name
char(20), unit_price number(10)
CONSTRAINT od_id_pk PRIMARY KEY(order_id),
CONSTRAINT pd_id_fk FOREIGN KEY(product_id) REFERENCES product(product_id)
);
This constraint ensures that a column or a group of columns in each row have a distinct
value. A column(s) can have a null value but the values cannot be duplicated.
This constraint defines a business rule on a column. All the rows must satisfy this rule. The
constraint can be applied for a single column or a group of columns.
For Example: In the employee table to select the gender of a person, the query would be
like
CREATE TABLE employee ( id
number(5) PRIMARY KEY,
name char(20), dept char(10),
age number(2),
gender char(1),
salary number(10),
location char(10),
CONSTRAINT gender_ck CHECK (gender in ('M','F'))
);
RELATIONAL MODEL IN DBMS
Relational Model (RM) represents the database as a collection of relations. A relation is
nothing but a table of values. Every row in the table represents a collection of related data
values. These rows in the table denote a real-world entity or relationship.
The table name and column names are helpful to interpret the meaning of values in each row.
The data are represented as a set of relations. In the relational model, data are stored as
tables. However, the physical storage of the data is independent of the way the data are
logically organized.
• Attribute: Each column in a Table. Attributes are the properties which define a
relation. e.g., Student_Rollno, NAME,etc.
• Tables – In the Relational model the, relations are saved in the table format. It is
stored along with its entities. A table has two properties rows and columns. Rows
represent records and columns represent attributes.
• Tuple – It is nothing but a single row of a table, which contains a single record.
• Relation Schema: A relation schema represents the name of the relation with its
attributes.
• Degree: The total number of attributes which in the relation is called the degree of the
relation.
• Cardinality: Total number of rows present in the Table.
• Column: The column represents the set of values for a specific attribute.
• Relation instance – Relation instance is a finite set of tuples in the RDBMS system.
Relation instances never have duplicate tuples.
• Relation key – Every row has one, two or multiple attributes, which is called relation
key.
• Attribute domain – Every attribute has some pre-defined value and scope which is
known as attribute domain.
COUNT
SYNTAX:
SELECT COUNT(column_name)
FROM table_name
WHERE condition;
2)
AVERAGE
SYNTAX:
SELECT AVG(column_name)
FROM table_name
WHERE condition;
3)
SUM
SYNTAX
SELECT SUM(column_name)
4)
FROM table_name
WHERE condition;
MINIMUM
5)
SYNTAX:
SELECT MIN(column_name)
FROM table_name
WHERE condition;
6)
MAXIMUM
SYNTAX:
SELECT MAX(column_name)
FROM table_name
WHERE condition;
7)
INTRODUCTION TO ENTITY RELATIONSHIP MODEL IN DBMS o ER model
stands for an Entity-Relationship model. It is a high-level data model.
This model is used to define the data elements and relationship for a
specified system.
o It develops a conceptual design for the database. It also develops a
very simple and easy to design view of data. o In ER modeling, the
database structure is portrayed as a diagram called an entity-
relationship diagram.
The Library Management System database keeps track of readers with the following considerations –
● The system keeps track of the staff with a single point authentication system comprising
login Id and password.
● Staff maintains the book catalog with its ISBN, Book title, price(in INR), category(novel,
general, story), edition, author Number and details.
● A publisher has publisher Id, Year when the book was published, and name of the book.
● Readers are registered with their user_id, email, name (first name, last name), Phone no
(multiple entries allowed), communication address. The staff keeps track of readers.
● Readers can return/reserve books that stamps with issue date and return date. If not
returned within the prescribed time period, it may have a due date too.
● Staff also generate reports that has readers id, registration no of report, book no and
return/issue info.
● This Library ER diagram illustrates key information about the Library, including entities
such as staff, readers, books, publishers, reports, and authentication system. It allows for
understanding the relationships between entities.
●