Skip to content

GuChad369/query_processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Relax System Documentation

Instruction:

To run the system using: python3 main.py

Overview:

The "Relax" system is designed to process text-based representations of relations and execute relational algebra queries.

Data Structure:

Relations are stored using dictionaries.

Entering Relations:

Format: Relations must be defined in a structured format as shown in the examples below.
End Marker: Always conclude your relation input with "END" on a new line.
Example:
    Student = {
        id, name, email, Dept
        1, 'Alex', '[email protected]', Sales
        2, 'John', '[email protected]', Finance
        3, 'Mo', '[email protected]', HR
    }
    END

Relational Algebra Query Format:

Queries must adhere to the following syntax:
    1.Selection:
        select [Age = 18] (Student)
    2.Projection:
        project [name, age] (Student)
    3.Join Operations:
        join [Student.name = Employee.name] (Student, Employee)
        fjoin [Student.name = Employee.name] (Student, Employee)
        rjoin [Student.name = Employee.name] (Student, Employee)
        fjoin [Student.name = Employee.name] (Student, Employee)
    4.Set Operations:
        Union: (Student) + (Employee)
        Intersection: (Student) ^ (Employee)
        Difference: (Student) - (Employee)

Example:

Student = { id, name, email, Dept 1, 'Alex', '[email protected]', Sales 2, 'John', '[email protected]', Finance 3, 'Mo', '[email protected]', HR }

Employee = { id, name, email, Dept 1, 'Alex', '[email protected]', Sales 2, 'Max', '[email protected]', Finance 3, 'Go', '[email protected]', HR }

Department = { name, budget 'Finance', 20000 'Sales', 30000 'IT', 40000 } END

project [Employee.id, Department.name, Department.budget] (select [Employee.id > 1] (fjoin [Employee.Dept = Department.name] (Employee, Department)))

(project [name, email] ((select [id > 2] (Employee)) - (select [id < 2] (Student)))) ^ (project [name, email] ((select [id > 2] (Employee)) + (select [id < 2] (Student))))

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages