Professional Documents
Culture Documents
PRACTICAL
[SEMESTER-3]
Enrollment number-2121270167
BY-
ANKIT
BCA 301 (DATA BASE MANAGEMENT SYSTEMS)
- Relational Modal-
In the concept of relational database management system, data is organized into
tables. Tables are similar to folders in a file system, where each table stores a
collection of information. Tables are further divided into columns and rows. Columns
represent the attributes of an entity, while rows represent the entities themselves.
Let's take a relational database example: In a table that stores information about
students, the columns would represent attributes such as name, date of birth, and
major. In contrast, the rows would represent individual students.
A relational model is a powerful tool for organizing and manipulating data. However,
it is also relatively easy to understand and use.
Features of Relational Model in DBMS
The relational model in DBMS has several features that make it well suited for storing
data: atomicity, consistency, isolation, durability, data consistency, data working
together, data flexibility, and lookup relationships.
Atomicity keeps data accurate by ensuring that all changes to the data are either
made completely or not made at all and that there are no partial changes to the
data.
Consistency ensures that the state of the database remains consistent throughout
the transaction.
Isolation ensures that changes made by one transaction are not visible to other
transactions until the changes are committed.
Durability ensures that once changes are committed, they will remain even if there is
a system failure.
Types of Relational Models
There are generally three types of relational models in DBMS -
Perhaps the most important advantage of the relational model is its accuracy.
Because data is organized into tables, it is easy to keep track of information and
ensure that it is up-to-date. This accuracy is essential for businesses that rely on
database information to make decisions.
The relational model is also easy to use. Users can easily access data and run queries
without needing to understand complex concepts. This ease of use makes the
relational model ideal for businesses needing to quickly retrieve information from
their databases.
The relational model also supports collaboration by allowing multiple users to access
and update the same data. This feature is essential for businesses that need to share
information between departments or across locations.
Finally, the relational model offers security features that protect data from
unauthorized access and modification. These features are critical for businesses that
must ensure their data's confidentiality. This is why it is recommended to go for a
designed exclusively for database administrators and enthusiasts. This is helpful to
those who want to deploy and administer cutting-edge applications at scale.
One downside is the maintenance problem. As data is added, deleted, and updated,
the relational model can become increasingly complex and difficult to manage. This
can lead to costly errors and reduced efficiency.
Another issue is cost. Relational databases can be expensive to set up and maintain.
They also require significant storage space, which can add to the overall cost.
Another potential downside is the lack of scalability. As data grows, it can become
increasingly difficult to query and update a relational database in a timely manner.
Finally, the structure of the relational model in DBMS is complex and can also be
challenging. The need for multiple tables and relationships can make it difficult to
understand and work with a relational database.
For these reasons, it is important to weigh the pros and cons of implementing the
concept of a relational database management system before making a decision.
Conclusion
A relational model is a powerful tool for managing data in a DBMS. The relational
model provides a flexible way to store and retrieve information by structuring data
into tables and enforcing relationships between them. Additionally, using primary
and foreign keys ensures that data is consistent and can be easily linked together.
Despite these advantages, the relational model has some limitations, such as its
reliance on flat files and the difficulty of representing hierarchical data. However,
these limitations can be overcome with careful design and implementation.
If you are looking for more information on this topic, we suggest checking out our
With this course, you will learn everything there is to know about using MongoDB,
such as writing code, building real-world projects and learning Cloud Labs.
o In the given table, NAME, ROLL_NO, PHONE_NO, ADDRESS, and AGE are the attributes.
o The instance of schema STUDENT has 5 tuples.
o t3 = <Laxman, 33289, 8583287182, Gurugram, 20>
Structure and Query Language
Structured Query Language (SQL) is a specialized programming language designed for
interacting with a database. SQL allows us to perform three main tasks:
Transact: Transact SQL provides the ability to insert, update, and delete data
stored in a relational database.
Data: The data query language is the part used to interact with stored data. This
serves to enable users to query the data and conduct the task of data analysis.
Commonly Used SQL Statements
The following is a list of commonly used SQL commands that can be used to create
tables, insert data, change the structure of the tables, and query the data.
CREATE
The CREATE statement is used to create tables in a database. The statement can define
the field names and field data types within a table. The CREATE statement is also used
to define the unique identities of the table using primary key constraints. It is also
used to describe the relationships between tables by defining a foreign key.
Template:
Column_1 Datatype1,
Column_2 Datatype2..
);
ALTER
The ALTER statement is used to change the structure of a table in the database. The
statement can be used to create a new column or change the data type of an existing
column.
Template:
The DROP statement is used to delete a table from a database. It must be used with
caution as deletion is irreversible.
Template:
The INSERT statement is used to add records or rows to a table. The name of the table
to insert records into is defined first. Then, the column names within the table are
defined. Finally, the values of the records are defined to insert into these columns.
Template:
VALUES (Value_1,…,Value_ N)
UPDATE
The UPDATE statement is used to modify records in a table. The statement changes the
values of a specified subset of records held in the defined columns of the table. It is a
good practice to filter rows using a WHERE clause when updating records. Otherwise,
all records will be altered by the UPDATE statement.
Template:
DELETE
The DELETE statement is used to delete rows from a table based on criteria defined
using a WHERE clause. The statement should be used carefully, as all deletion in a
database is permanent. If a mistake is made using a DELETE statement, the database
will need to be restored from a backup.
Template:
DELETE FROM [table Name]
The SELECT statement is one of the most used statements in SQL. It is used to select
rows from one or more tables in a database. A SELECT statement is usually used with a
WHERE clause to return a subset of records based on a user-defined criterion. The
SELECT statement is used to conduct most data analysis tasks as it allows the user to
extract and transform the desired records from a database.
Template:
First, we use the CREATE statement to define the structure of the table. Our table will
have the following columns and data types:
ID: A unique identifier for every record entered in the table (INTEGER)
Company Name: The name of the company (TEXT)
Ticker: Company ticker used to identify the company stock on an exchange (TEXT)
Price: The latest closing price of the stock (FLOAT)
PE Ratio: The price to earnings ratio of the stock (FLOAT)
We can follow the template described above to write the CREATE statement. The
following statement creates the table:
CREATE TABLE price Table (
ID INTEGER,
price FLOAT,
pe Ratio FLOAT
);
Next, we insert some records into the table using the INSERT statement. Following are
two examples of inserting rows in our table.
INSERT INTO price Table ( ID, [company Name], [ticker], [price], [pe Ratio])
INSERT INTO price Table ( ID, [company Name], [ticker], [price], [pe Ratio])
The instruction returns the three stocks: Intel, Ford, and General Motors. The above is
a simple example, but a larger database with more securities and fundamental data
can be a powerful tool in identifying potential investments.
Additional Resources
Learn more about Structured Query Language through CFI’s SQL
Fundamentals course. To keep learning and developing your knowledge, we highly
recommend the additional resources .
Rules:
SQL follows the following rules:
o Structure query language is not case sensitive. Generally, keywords of SQL are written
in uppercase.
o Statements of SQL are dependent on text lines. We can use a single SQL statement on
one or multiple text line.
o Using the SQL statements, you can perform most of the actions in a database.
o SQL depends on tuple relational calculus and relational algebra.
SQL process:
o When an SQL command is executing for any RDBMS, then the system figure out the
best way to carry out the request and the SQL engine determines that how to interpret
the task.
o In the process, various components are included. These components can be
optimization Engine, Query engine, Query dispatcher, classic, etc.
o All the non-SQL queries are handled by the classic query engine, but SQL query engine
won't handle logical files.
ADVANTAGES OF SQL
There are the following advantages of SQL:
High speed
Using the SQL queries, the user can quickly and efficiently retrieve a large amount
of records from a database.
No coding needed
In the standard SQL, it is very easy to manage the database system. It doesn't
require a substantial amount of code to manage the database system.
Portability
SQL can be used in laptop, PCs, server and even some mobile phones.