{"id":17800648,"url":"https://github.com/faizan-khan-iit/ra_console","last_synced_at":"2025-07-13T20:03:10.611Z","repository":{"id":224195437,"uuid":"71243570","full_name":"faizan-khan-iit/ra_console","owner":"faizan-khan-iit","description":"Implementation of Relational Algebra functions","archived":false,"fork":false,"pushed_at":"2017-09-21T05:21:01.000Z","size":389,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-01T09:53:02.406Z","etag":null,"topics":["calculator","dbms","programming-assignment","project","relation-algebra-calculator","relational-algebra"],"latest_commit_sha":null,"homepage":"https://faizan-khan-iit.github.io/ra_console/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/faizan-khan-iit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-18T12:00:24.000Z","updated_at":"2019-08-25T14:17:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"c0afff9f-2b7e-4e76-9964-a55c0133f22a","html_url":"https://github.com/faizan-khan-iit/ra_console","commit_stats":null,"previous_names":["faizan-khan-iit/ra_console"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/faizan-khan-iit/ra_console","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faizan-khan-iit%2Fra_console","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faizan-khan-iit%2Fra_console/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faizan-khan-iit%2Fra_console/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faizan-khan-iit%2Fra_console/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faizan-khan-iit","download_url":"https://codeload.github.com/faizan-khan-iit/ra_console/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faizan-khan-iit%2Fra_console/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265198300,"owners_count":23726446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calculator","dbms","programming-assignment","project","relation-algebra-calculator","relational-algebra"],"created_at":"2024-10-27T12:26:37.706Z","updated_at":"2025-07-13T20:03:10.490Z","avatar_url":"https://github.com/faizan-khan-iit.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Implementation of Relational Algebra functions\n\n--------\n\n\n### Aim of the Project\n\nTo write a program in C++ to implement Relational Algebra functions present in DBMS.\n\n--------\n\n### Functions implemented\n\nThe program implements the following Relational Algebra functions:\n\n1. SELECT\n\n2. PROJECT\n\n3. RENAME\n\n4. UNION\n\n5. SET DIFFERENCE\n\n6. CARTESIAN PRODUCT\n\n--------\n\n### Project Details\n\nThe program assumes the following:\n\n* The database folder is present in the same directory as the main project file\n* The database folder has a *db_info.txt* file containing the details of the database\n* The database folder has a *tables* subdirectory which contains all table files in space separated form in *.txt* format\n* The tables have their schema in the top three lines:\n    + First line has table name\n    + Second line has column names\n    + Third line has column data types\n* The data in the files is valid:\n    + There is no newline\n    + All data has same number of columns (except) table name\n    + The data types corresponding to the data are correct\n* The data types allowed are:\n    + *int*\n    + *float*\n    + *varchar*\n* Comparison accross data types is not allowed\n* Queries are delimited by a **;**\n\n--------\n\n### Syntax\n\nThe basic syntax of the queries is as follows:\n\nShow tables in database as specified in *db_info.txt*:\n```{}\nSHOW_TABLES;\n```\n\nSELECT:\n```{}\nSEL{predicate}(table_name);\n```\n\nPROJECT:\n```{}\nPRO{column_name1:column_name2}(table_name);\n```\n\nRENAME:\n```{}\nREN{new_table_name|column_name1:column_name2}(table_name);\n```\n\nUNION:\n```{}\nUNI(table_name1, table_name2);\n```\n\nSET DIFFERENCE:\n```{}\nDIF(table_name1, table_name2);\n```\n\nCARTESIAN PRODUCT:\n```{}\nCRP(table_name1, table_name2);\n```\nEXIT:\n```{}\nEXIT;\n```\n#### The predicate syntax for **SEL**:\n\n```{}\nSEL{(a \u003e b | c = d) \u0026 e ! f}(table_name);\n```\n\nThe available operators are:\n\n1. **+** : Add two *ints* or *floats*\n2. **-** : Subtract two *ints* or *floats*\n3. __*__ : Multiply two *ints* or *floats*\n4. **/** : Divide two *ints* or *floats*\n5. **=** : Compare two operands, `TRUE` if equal\n6. **!** : Compare two operands, `TRUE` if unequal\n7. **\u003e** : Compare two operands, `TRUE` if former is greater than latter\n8. **\u003c** : Compare two operands, `TRUE` if former is lesser than latter\n9. **\u0026** : Logical ```AND```\n10. **|** : Logical ```OR```\n\nNOTES:\n\n* Comparison between different data types is not allowed\n\n* `varchar` (Strings) are enclosed in `'`\n\n* `float` operands *must* have a `.`\n\n* Invalid operands are not allowed\n\n#### The predicate syntax for **PRO**:\n\n```{}\nPRO{a:b:c:d}(table_name);\n```\n\nNOTES:\n\n* Column names must be separated by a `:`\n\n* Column names must be present in table\n\n* Column names are displayed in given order\n\n\n#### The predicate syntax for **REN**:\n\n```{}\nREN{new_table_name|a:b:c:d}(table_name);\nREN{new_table_name}(table_name);\n```\n\nNOTES:\n\n* Table name and column names must be separated by a `|`\n\n* Column names must be separated by a `:`\n\n* Column names must be valid\n\n* Column names are renamed in given order\n\n* If no column names are provided, the colum names are retained\n\n* Either all or none of the column names must be provided\n\n--------\n\n### Sample Queries\n\n```\n1. SEL{faculty.salary \u003e 80000 \u0026 dept = 'CSE'}(faculty);\n2. PRO{id:name:grade}(studuent);\n3. UNI(PRO{name}(faculty), PRO{name}(student));\n4. DIF(PRO{name}(faculty), PRO{name}(student));\n5. CRP(student, course);\n6. REN{stud|stud_id:name:cgpa}(student);\n```\nFor more queries, see [Query file](https://github.com/faizan-khan-iit/ra_console/blob/master/Queries/queries.pdf)\n\n--------\n\n### Comments:\n\n* Syntax errors are not allowed\n* SELECT takes exactly one predicate\n* RENAME **cannot rename to a table already present**\n* Column and table names must be alphanumeric\n* Invalid comparisons between data types are not allowed\n* UNI and DIF operations must **have same column names and data types**. Order need not be same\n* Nested queries are allowed\n* CRP operation needs **different column names**\n* PRO should have **unique column names**\n* All whitespaces are ignored\n\n\n--------\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaizan-khan-iit%2Fra_console","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaizan-khan-iit%2Fra_console","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaizan-khan-iit%2Fra_console/lists"}