MODULE-2
RELATIONAL MODEL
Relational model is simple model in which database is represented as a collection of “relations” where each
relation is represented by two-dimensional table.
The relational model was founded by E. F. Codd of the IBM in 1972. The basic concept in the relational model is that
of a relation.
Properties:
o It is column homogeneous. In other words, in any given column of a table, all items are of the same kind.
o Each item is a simple number or a character string. That is a table must be in first normal form.
o All rows of a table are distinct.
o The ordering of rows within a table is immaterial.
o The column of a table is assigned distinct names, and the ordering of these columns is immaterial.
Domain, attributes tuples and relational:
Tuple:
Each row in a table represents a record and is called a tuple. A table containing ‘n’ attributes in a record is called is
called n-tuple.
Example for a tuple from table-1 is (A-101, Downtown, 500)
Attributes:
The name of each column in a table is used to interpret its meaning and is called an attribute. Each table is called a
relation.
In the above table, account_number, branch name, balance are the attributes.
Domain:
A domain is a set of values that can be given to an attribute. So every attribute in a table has aspecific domain. Values to these
attributes can’t be assigned outside their domains.
In the above table the domain of attribute balance is “non-negative number”.
Relation:
A relation consists of
o Relational schema
o Relation instance
Relational Schema:
A relational schema specifies the relation’s name, its attributes, and the domain of each attribute. If R is the name of a relation
and A1, A2,…An is a list of attributes representing R then R(A1,A2,…,An) is called a Relational Schema. Each attribute in this
relational schema takes a value from some specific domain called domain (Ai).
Example:
PERSON (PERSON_ID: INTEGER, NAME:STRING, AGE:INTEGER, ADDRESS:STRING)
Total number of attributes in a relation denotes the degree of a relation since the PERSON relation scheme contains
four attributes, so this relation is of degree 4.
Relation Instance:
A relational instance denoted as r is a collection of tuples for a given relational schema at a specific point of time.
A relation state r to the relations schema R (A1, A2…, An) also denoted by r(R) is a set of n-tuples R{t1,t2,…tm}
Where each n-tuple is an ordered list of n values
T=<v1,v2,….vn>
Where each vi belongs to domain (Ai) or contains null values.
The relation schema is also called ‘intension’ and the relation state is also called ‘extension’.
E.g.: Relation schema for Student
STUDENT (rollno:string, name:string, city:string, age:integer)
✓ Relation instance:
Student:
Rollno Name City Age
101 Sujit Bam 23
102 Kunal bbsr 22
Keys:
❖ Primary key:
The primary key is the candidate key that is chosen by the database designer as the principal means of identifying
entities within an entity set. The remaining candidate keys if any are called alternate key.
❖ Super key:
A super key is an attribute, or a set of attributes used to identify the records uniquely in a relation. For example,
customer-id, (cname, customer-id), (cname,telno)
❖ Candidate key:
Super keys of a relation can contain extra attributes. Candidate keys are minimal super keys. i.e, such a key contains
no extraneous attribute. An attribute is called extraneous if even after removing it from the key, makes the remaining
attributes still has the properties of a key (atribute represents entire table).
In a relation R, a candidate key for R is a subset of the set of attributes of R, which have the following properties:
i. Uniqueness: No two distinct tuples in R have the same values for the candidate key.
ii. Irreducible: No proper subset of the candidate key has the uniqueness property that is the
candidate key.
iii. A candidate key’s values must exist. It can’t be null. The values of a candidate key must be
stable. Its value can’t change outside the control of the system.
Eg: (cname,telno)
Rule-03: For Strong Entity Set with Multi Values Attributes:
A strong entity set with any number of multi valued attributes will require two tables in relational model.
• One table will contain all the simple attributes with the primary key.
• Other table will contain the primary key and all the multi values attributes.
`
Case-04: Binary relationship with cardinality ratio 1:1
Weak entity set always appears in association with identifying relationship with total participation constraint.
Integrity Constraints
o Integrity constraints are a set of rules. It is used to maintain the quality of information.
o Integrity constraints ensure that the data insertion, updating, and other processes have
to be performed in such a way that data integrity is not affected.
o Thus, integrity constraint is used to guard against accidental damage to the database.
Types of Integrity Constraint
1. Domain constraints
o Domain constraints can be defined as the definition of a valid set of values for an
attribute.
o The data type of domain includes string, character, integer, time, date, currency, etc.
The value of the attribute must be available in the corresponding domain.
Example:
2. Entity integrity constraints
o The entity integrity constraint states that primary key value can't be null.
o This is because the primary key value is used to identify individual rows in relation
and if the primary key has a null value, then we can't identify those rows.
o A table can contain a null value other than the primary key field.
[Link] Integrity Constraints
o A referential integrity constraint is specified between two tables.
o In the Referential integrity constraints, if a foreign key in Table 1 refers to the
Primary Key of Table 2, then every value of the Foreign Key in Table 1 must be null
or be available in Table 2.
3. Key constraints
o Keys are the entity set that is used to identify an entity within its entity set uniquely.
o An entity set can have multiple keys, but out of which one key will be the primary
key. A primary key can contain a unique and null value in the relational table.
Integrity constraints over relations
An integrity constraint (IC) is a condition that is specified on a database schema and restricts
the data can be.
stored in an instance of the database.
Various restrictions on data that can be specified on a relational database schema in the form of
‘constraints.
A DBMS enforces integrity constraints, in that it permits only legal instances to be stored in the
database.
Integrity constraints are specified and enforced at different times as
below.1. When the DBA or end user defines a database schema, he
or she specifies the ICs that must hold on any instance of this
database.
[Link] a data base application is run, the DBMS checks for
violations and disallows changes to the data that violate
the specified ICs.
Constraints in DBMS
Constraints enforce limits to the data or type of data that can be inserted/updated/deleted
from a table. The whole purpose of constraints is to maintain the data integrity during an
update/delete/insert into a table. In this tutorial we will learn several types of constraints that
can be created in RDBMS.
Types of
constraints
Not Null
Unique
Default
Check
Key Constraints – PRIMARY KEY, FOREIGN KEY
Domain Constraint
Mapping
constraints
NOT NULL:
NOT NULL constraint makes sure that a column does not hold NULL value. When we don’t
provide value for a particular column while inserting a record into a table, it takes NULL
value by default. By specifying NULL constraint, we can be sure that a particular column(s)
cannot have NULL values.
Example:
CREATE TABLE STUDENT(
ROLL_NO INT NOT NULL,
STU_NAME VARCHAR (35) NOT NULL,
STU_AGE INT NOT NULL,
STU_ADDRESS VARCHAR (235),
PRIMARY KEY (ROLL_NO)
);
UNIQUE:
UNIQUE Constraint enforces a column or set of columns to have unique values. If a column has a
unique constraint, it means that particular column cannot have duplicate values in a table.
CREATE TABLE STUDENT(
ROLL_NO INT NOT NULL,
STU_NAME VARCHAR (35) NOT NULL UNIQUE,
STU_AGE INT NOT NULL,
STU_ADDRESS VARCHAR (35) UNIQUE,
PRIMARY KEY (ROLL_NO)
);
DEFAULT:
The DEFAULT constraint provides a default value to a column when there is no value provided while
inserting a record into a table.
CREATE TABLE STUDENT(
ROLL_NO INT NOT NULL,
STU_NAME VARCHAR (35) NOT NULL,
STU_AGE INT NOT NULL,
EXAM_FEE INT DEFAULT 10000,
STU_ADDRESS VARCHAR (35) ,
PRIMARY KEY (ROLL_NO)
);
CHECK:
This constraint is used for specifying range of values for a particular column of a table. When this
constraint is being set on a column, it ensures that the specified column must have the value falling
in the specified range.
CREATE TABLE STUDENT(
ROLL_NO INT NOT NULL CHECK(ROLL_NO >1000) ,
STU_NAME VARCHAR (35) NOT NULL,
STU_AGE INT NOT NULL,
EXAM_FEE INTDEFAULT 10000,
STU_ADDRESS VARCHAR (35) ,
PRIMARY KEY (ROLL_NO)
);
In the above example we have set the check constraint on ROLL_NO column of STUDENT table. Now,
the ROLL_NO field must have the value greater than 1000.
Key constraints:
PRIMARY KEY:
Primary key uniquely identifies each record in a table. It must have unique values and cannot contain
nulls. In the below example the ROLL_NO field is marked as primary key, that means the ROLL_NO
field cannot have duplicate and null values.
CREATE TABLE STUDENT(
ROLL_NO INT NOT NULL,
STU_NAME VARCHAR (35) NOT NULL UNIQUE,
STU_AGE INT NOT NULL,
STU_ADDRESS VARCHAR (35) UNIQUE,
PRIMARY KEY (ROLL_NO)
);
FOREIGN KEY:
Foreign keys are the columns of a table that points to the primary key of another table. They act as a cross-
reference between tables.
Domain constraints:
Each table has certain set of columns, and each column allows a same type of data, based on its data type. The
column does not accept values of any other data type.
Domain constraints are user defined data type, and we can define them like this:
Domain Constraint = data type + Constraints (NOT NULL / UNIQUE / PRIMARY KEY / FOREIGN KEY / CHECK /
DEFAULT).
Views in SQL
o Views in SQL are considered as a virtual table. A view also contains rows and columns.
o To create the view, we can select the fields from one or more tables present in the database.
o A view can either have specific rows based on certain condition or all the rows of a table.
Sample table:
Student_Detail
STU_ID NAME ADDRESS
1 Stephan Delhi
2 Kathrin Noida
3 David Ghaziabad
4 Alina Gurugram
Student_Marks
STU_ID NAME MARKS AGE
1 Stephan 97 19
2 Kathrin 86 21
3 David 74 18
4 Alina 90 20
5 John 96 18
1. Creating view
A view can be created using the CREATE VIEW statement. We can create a view from a
single table or multiple tables.
Syntax:
CREATE VIEW view_name AS
SELECT column1, column2.....
FROM table_name
WHERE condition;
2. Creating View from a single table
Query:
CREATE VIEW DetailsView AS
SELECT NAME, ADDRESS
FROM Student_Details
WHERE STU_ID < 4;
Just like table query, we can query the view to view the data.
SELECT * FROM DetailsView;
Output:
NAME ADDRESS
Stephan Delhi
Kathrin Noida
David Ghaziabad
3. Creating View from multiple tables
View from multiple tables can be created by simply include multiple tables in the SELECT
statement.
In the given example, a view is created named MarksView from two tables Student_Detail
and Student_Marks.
Query:
CREATE VIEW MarksView AS
SELECT Student_Detail.NAME, Student_Detail.ADDRESS, Student_Marks.MARKS
FROM Student_Detail, Student_Mark
WHERE Student_Detail.NAME = Student_Marks.NAME;
To display data of View MarksView:
SELECT * FROM MarksView;
NAME ADDRESS MARKS
Stephan Delhi 97
Kathrin Noida 86
David Ghaziabad 74
Alina Gurugram 90
4. Deleting View
A view can be deleted using the Drop View statement.
Syntax
1. DROP VIEW view_name;
Example:
If we want to delete the View MarksView, we can do this as:
1. DROP VIEW MarksView;
Uses of a View :
A good database should contain views due to the given reasons:
1. Restricting data access –
Views provide an additional level of table security by restricting access to a
predetermined set of rows and columns of a table.
2. Hiding data complexity –
A view can hide the complexity that exists in a multiple table join.
3. Simplify commands for the user –
Views allows the user to select information from multiple tables without requiring the
users to actually know how to perform a join.
4. Store complex queries –
Views can be used to store complex queries.
5. Rename Columns –
Views can also be used to rename the columns without affecting the base tables
provided the number of columns in view must match the number of columns specified
in select statement. Thus, renaming helps to to hide the names of the columns of the
base tables.
6. Multiple view facility –
Different views can be created on the same table for different users.
part-2
Relational Algebra
• Relational Algebra is procedural query language, which takes Relation as input and
generates relation as output. Relational algebra mainly provides theoretical
foundation for relational databases and SQL.
• Relational algebra is a procedural query language, it means that it tells what data to be
retrieved and how to be retrieved.
• Relational Algebra works on the whole table at once, so we do not have to use loops
etc to iterate over all the rows (tuples) of data one by one.
• All we have to do is specify the table name from which we need the data, and in a
single line of command, relational algebra will traverse the entire given table to fetch
data for you.
Basic/Fundamental Operations:
1. Select (σ)
2. Project (∏)
3. Union (𝖴)
4. Set Difference (-)
5. Cartesian product (X)
6. Rename (ρ)
1. Select Operation (σ) :This is used to fetch rows (tuples) from table(relation) which
satisfies a given condition.
Syntax: σp(r)
➢ σ is the predicate
➢ r stands for relation which is the name of the table
➢ p is prepositional logic
ex: σage > 17 (Student)
This will fetch the tuples(rows) from table Student, for which age will be greater than 17.
σage > 17 and gender = 'Male' (Student)
This will return tuples(rows) from table Student with information of male students, of age
more than 17.
BRANCH_NAME LOAN_NO AMOUNT
Downtown L-17 1000
Redwood L-23 2000
Perryride L-15 1500
Downtown L-14 1500
Mianus L-13 500
Roundhill L-11 900
Perryride L-16 1300
Input:
σ BRANCH_NAME="perryride" (LOAN)
Output:
BRANCH_NAME LOAN_NO AMOUNT
Perryride L-15 1500
Perryride L-16 1300
Project Operation (∏):
• Project operation is used to project only a certain set of attributes of a relation. In
simple words, If you want to see only the names all of the students in
the Student table, then you can use Project Operation.
• It will only project or show the columns or attributes asked for, and will also remove
duplicate data from the columns.
Syntax of Project Operator (∏)
∏ column_name1, column_name2,..... , column_nameN(table_name)
Example:
∏Name, Age(Student)
Above statement will show us only the Name and Age columns for all the rows of data
in Student table.
Example: CUSTOMER RELATION
NAME STREET CITY
Jones Main Harrison
Smith North Rye
Hays Main Harrison
Curry North Rye
Johnson Alma Brooklyn
Brooks Senator Brooklyn
Input:
∏ NAME, CITY (CUSTOMER)
Output:
NAME CITY
Jones Harrison
Smith Rye
Hays Harrison
Curry Rye
Johnson Brooklyn
Brooks Brooklyn
Union Operation (𝖴):
• This operation is used to fetch data from two relations(tables) or temporary
relation(result of another operation).
• For this operation to work, the relations(tables) specified should have same number of
attributes(columns) and same attribute domain. Also the duplicate tuples are
autamatically eliminated from the result.
Syntax: A 𝖴 B
∏Student(RegularClass) 𝖴 ∏Student(ExtraClass)
Example:
DEPOSITOR RELATION
CUSTOMER_NAME ACCOUNT_NO
Johnson A-101
Smith A-121
Mayes A-321
Turner A-176
Johnson A-273
Jones A-472
Lindsay A-284
BORROW RELATION
CUSTOMER_NAME LOAN_NO
Jones L-17
Smith L-23
Hayes L-15
Jackson L-14
Curry L-93
Smith L-11
Williams L-17
Input:
∏ CUSTOMER_NAME (BORROW) 𝖴 ∏ CUSTOMER_NAME (DEPOSITOR)
Output:
CUSTOMER_NAME
Johnson
Smith
Hayes
Turner
Jones
Lindsay
Jackson
Curry
Williams
Mayes
Set Difference (-):
This operation is used to find data present in one relation and not present in the second
relation. This operation is also applicable on two relations, just like Union operation.
Syntax: A - B
where A and B are relations.
For example, if we want to find name of students who attend the regular class but not the
extra class, then, we can use the below operation:
∏Student(RegularClass) - ∏Student(ExtraClass)
Input: ∏ CUSTOMER_NAME (BORROW) ∩ ∏ CUSTOMER_NAME (DEPOSITOR)
CUSTOMER_NAME
Smith
Jones
Cartesian Product (X):
This is used to combine data from two different relations(tables) into one and fetch data from
the combined relation.
Syntax: A X B
For example, if we want to find the information for Regular Class and Extra Class which are
conducted during morning, then, we can use the following operation:
σtime = 'morning' (RegularClass X ExtraClass)
For the above query to work, both RegularClass and ExtraClass should have the
attribute time.
Notation: E X D
EMPLOYEE
EMP_ID EMP_NAME EMP_DEPT
1 Smith A
2 Harry C
3 John B
DEPARTMENT
DEPT_NO DEPT_NAME
A Marketing
B Sales
C Legal
Input:
EMPLOYEE X DEPARTMENT
Output:
EMP_ID EMP_NAME EMP_DEPT DEPT_NO DEPT_NAME
1 Smith A A Marketing
1 Smith A B Sales
1 Smith A C Legal
2 Harry C A Marketing
2 Harry C B Sales
2 Harry C C Legal
3 John B A Marketing
3 John B B Sales
3 John B C Legal
Rename Operation (ρ):
This operation is used to rename the output relation for any query operation which returns
result like Select, Project etc. Or to simply rename a relation(table)
Syntax: ρ(RelationNew, RelationOld)
The rename operation is used to rename the output relation. It is denoted by rho (ρ).
Example: We can use the rename operator to rename STUDENT relation to STUDENT1.
ρ(STUDENT1, STUDENT)
Join in DBMS:
• A JOIN clause is used to combine rows from two or more tables, based on a related
column between them.
• Join in DBMS is a binary operation which allows you to combine join product and
selection in one single statement.
• The goal of creating a join condition is that it helps you to combine the data from two
or more DBMS tables.
• The tables in DBMS are associated using the primary key and foreign keys.
Types of SQL JOIN
1. INNER JOIN
2. LEFT JOIN
3. RIGHT JOIN
4. FULL JOIN
Table name: EMPLOYEE
EMP_ID EMP_NAME CITY SALARY AGE
1 Angelina Chicago 200000 30
2 Robert Austin 300000 26
3 Christian Denver 100000 42
4 Kristen Washington 500000 29
5 Russell Los angels 200000 36
6 Marry Canada 600000 48
PROJECT
PROJECT_NO EMP_ID DEPARTMENT
101 1 Testing
102 2 Development
103 3 Designing
104 4 Development
1. INNER JOIN
In SQL, INNER JOIN selects records that have matching values in both tables as long as the
condition is satisfied.
It returns the combination of all rows from both the tables where the condition satisfies.
Syntax
SELECT table1.column1, table1.column2
FROM table1 INNER JOIN table2
ON table1.matching_column = table2.matching_column;
Query
SELECT EMPLOYEE.EMP_NAME, [Link]
FROM EMPLOYEE INNER JOIN PROJECT
ON PROJECT.EMP_ID = EMPLOYEE.EMP_ID;
Output
EMP_NAME DEPARTMENT
Angelina Testing
Robert Development
Christian Designing
Kristen Development
2. LEFT JOIN
The SQL left join returns all the values from left table and the matching values from the right
table. If there is no matching join value, it will return NULL.
Syntax
SELECT table1.column1, table1.column2 FROM table1
LEFT JOIN table2
ON table1.matching_column = table2.matching_column;
Query
SELECT EMPLOYEE.EMP_NAME, [Link]
FROM EMPLOYEE LEFT JOIN PROJECT
ON PROJECT.EMP_ID = EMPLOYEE.EMP_ID;
Output
EMP_NAME DEPARTMENT
Angelina Testing
Robert Development
Christian Designing
Kristen Development
Russell NULL
Marry NULL
3. RIGHT JOIN
In SQL, RIGHT JOIN returns all the values from the values from the rows of right table and
the matched values from the left table. If there is no matching in both tables, it will return
NULL.
Syntax
SELECT table1.column1, table1.column2
FROM table1 RIGHT JOIN table2
ON table1.matching_column = table2.matching_column;
Query
SELECT EMPLOYEE.EMP_NAME, [Link]
FROM EMPLOYEE RIGHT JOIN PROJECT
ON PROJECT.EMP_ID = EMPLOYEE.EMP_ID;
Output
EMP_NAME DEPARTMENT
Angelina Testing
Robert Development
Christian Designing
Kristen Development
4. FULL JOIN
In SQL, FULL JOIN is the result of a combination of both left and right outer join. Join
tables have all the records from both tables. It puts NULL on the place of matches not found.
Syntax
SELECT table1.column1, table1.column2
FROM table1 FULL JOIN table2
ON table1.matching_column = table2.matching_column;
Query
SELECT EMPLOYEE.EMP_NAME, [Link]
FROM EMPLOYEE
FULL JOIN PROJECT
ON PROJECT.EMP_ID = EMPLOYEE.EMP_ID;
Output
EMP_NAME DEPARTMENT
Angelina Testing
Robert Development
Christian Designing
Kristen Development
Russell NULL
Marry NULL
Division Operator in SQL
Division Operator (÷): Division operator A÷B can be applied if and only if:
• Attributes of B is proper subset of Attributes of A.
• The relation returned by division operator will have attributes = (All attributes of A –
All Attributes of B)
• The relation returned by division operator will return those tuples from relation A
which are associated to every B’s tuple.
The division operator is used when we have to evaluate queries which contain the
keyword ALL.
Relational Calculus:
Relational calculus is a non-procedural query language that tells the system what data to be
retrieved but doesn’t tell how to retrieve it. Relational Calculus exists in two forms:
1. Tuple Relational Calculus (TRC)
2. Domain Relational Calculus (DRC)
Tuple Relational Calculus (TRC)
Tuple relational calculus is used for selecting those tuples that satisfy the given condition.
Table: Student
First_Name Last_Name Age
Ajeet Singh 30
Chaitanya Singh 31
Rajeev Bhatia 27
Carl Pratap 28
Lets write relational calculus queries.
Query to display the last name of those students where age is greater than 30
{ t.Last_Name | Student(t) AND [Link] > 30 }
In the above query you can see two parts separated by | symbol. The second part is where we
define the condition and in the first part, we specify the fields which we want to display for
the selected tuples.
The result of the above query would be:
Last_Name
Singh
Query to display all the details of students where Last name is ‘Singh’
{ t | Student(t) AND t.Last_Name = 'Singh' }
Output:
First_Name Last_Name Age
Ajeet Singh 30
Chaitanya Singh 31
Ex:
Table-1: Customer
Customer name Street City
Saurabh A7 Patiala
Mehak B6 Jalandhar
Sumiti D9 Ludhiana
Ria A5 Patiala
Table-2: Branch
Branch name Branch city
ABC Patiala
DEF Ludhiana
GHI Jalandhar
Table-3: Account
Account number Branch name Balance
1111 ABC 50000
1112 DEF 10000
1113 GHI 9000
Account number Branch name Balance
1114 ABC 7000
Table-4: Loan
Loan number Branch name Amount
L33 ABC 10000
L35 DEF 15000
L49 GHI 9000
L98 DEF 65000
Table-5: Borrower
Customer name Loan number
Saurabh L33
Mehak L49
Ria L98
Table-6: Depositor
Customer name Account number
Saurabh 1111
Customer name Account number
Mehak 1113
Sumiti 1114
Queries-1: Find the loan number, branch, amount of loans of greater than or equal to
10000 amount.
{t| t ∈ loan 𝖠 t[amount]>=10000}
Resulting relation:
Loan number Branch name Amount
L33 ABC 10000
L35 DEF 15000
L98 DEF 65000
Domain Relational Calculus (DRC):
Domain Relational Calculus (DRC) is a theoretical framework used in the field of database
management systems (DBMS) to specify queries for retrieving data from a database. Unlike Tuple
Relational Calculus (TRC) which focuses on specifying conditions on tuples, DRC specifies
conditions on the domains of attributes within the tuples. DRC uses variables and quantifiers to
express queries in a concise and precise manner.
Let's illustrate Domain Relational Calculus with a simple example:
Consider a database schema for a university with the following relations:
• Student (sid, sname, age)
• Course (cid, cname, credits)
• Enroll (sid, cid, grade)
In the context of a Database Management System (DBMS), DRC would typically be implemented as
part of the query processing engine. Here's how DRC could be used within a DBMS:
✓ Query Specification: Users specify the information they want to retrieve from the database using
DRC. This specification includes conditions on the data that must be satisfied by the retrieved
tuples.
✓ Query Optimization: The DBMS internally translates the DRC query into an executable form.
During this translation process, the query optimizer analyzes the query and generates an optimal
query execution plan. The goal is to minimize the computational cost of retrieving the requested
data.
✓ Query Execution: The DBMS executes the optimized query plan, accessing the underlying data
stored in the database. This involves retrieving tuples from the relevant relations (tables), applying
any necessary filtering or join operations, and computing the final result set.
✓ Result Presentation: Once the query execution is complete, the DBMS presents the results to the
user in a suitable format. This could be a table of tuples, a graphical visualization, or any other
format specified by the user or application.
✓ Concurrency and Transaction Management: In a multi-user environment, the DBMS
ensures that DRC queries execute concurrently without interfering with each other. It also
provides mechanisms for transaction management to maintain data consistency and integrity.
Overall, Domain Relational Calculus provides a powerful and expressive way to specify queries in a
DBMS, allowing users to retrieve precisely the information they need from the database. Its formal
mathematical foundation also makes it well-suited for optimization and integration into modern
database systems.