RDBMS is Implementation of Relational database management system which is the first assignment on the course neural-symbolic.
It is a data base managment system that store structured data using tables(rows and columns);
A relational data model using n-ary relation to store data
R = {(a1,...,an) | a1 E A1 ,a2 E A2, ...,an E An}
- A table is a relation
- Rows are n-tuples
- Columns/Atributes comes from a defined set called Domain
A relational Schima contains the table name and it's atribute name.
A relational instance is a set of finite tuples created with a predefined schema. Look at the example below,it is the relational schima where table name is student and Name,Age and Department are Attributes.
Students | ||
---|---|---|
Name | Age | Department |
Based on this relational Schima we can create a table that of students info.
Name | Age | Department |
---|---|---|
Kirubel | 24 | CompEng |
Bemehiret | 23 | SoftEng |
Debora | 23 | CompEng |
Elias | 25 | ElecEng |
We have six operations on the tables
- Union : It is a relation between two tables where the resulting table will contain the information of both tables.
It is denoted by:
R1 U R2 = {(a1,...,an) | (a1,...,an) E R1 V (a1,..,an) E R1}
Note both the tables must have the same relational schema i.e. Attributes must match .
- Intersection : It is a relation between two tables where the resulting table will contain information duplicated in both tables.
It is denoted by:
R1 n R2 = {(a1,...,an) | (a1,..,an) E R1 & (a1,..,an) E R2 }
Note both the tables must have the same relational schema ie. Attributes must match .
- Difference : It is a relation between two tables where the resulting table will contain the information of the first table with out information in second table.
It is denoted by:
R1 - R2 = {(a1,...,an) | (a1,..,an) E R1 & ~((a1,..,an) E R2)}
Note both the tables must have the same relational schema ie. Attributes must match .
-
Projection
-
Selection
-
Natural join
The following commands are supported to use the RDBMS from command line
-
Create a relational schema with the specified name and attributes list
create,rschema,<rschema name>,<list of column names>
e.g:
create,rschema,Student,Name,Age
whereStudent
is rschema name andName,Age
is list of column names. -
Create an empty table with a given table name and table specification (i.e. relational schema)
create,table,<table name>,<name of rschema>
e.g:
create,table,Attendance,Student
whereAttendance
is the table name andStudent
is the name of the relational schema instance to use as specification for the table. -
Insert a row into an existing table
insert,<table name>,<row to insert>
e.g:
insert,Attendance,Kirub,25
whereAttendance
is the table name to insert into andKirub,25
is the data to be inserted into the Attendance table. -
Display data stored in a table
display,<table name>
e.g:
display,Attendance
whereAttendance
is name of the table to be displayed. -
Remove a row of data from a table
remove,row,<table name>,<row to remove>
e.g:
remove,row,Attendance,Kirub,25
whereAttendance
is name of the table andKirub,25
is the data to be removed. -
Remove or delete an existing table
remove,table,<table name>
e.g:
remove,Attendance
whereAttendance
is name of the table to be removed or deleted. -
Union of two tables
union,<first table name>,<second table name>
e.g:
union,Attendance,Grade
whereAttendance
is name of the first table andGrade
is name of the second table. -
Intersection of two tables
intersection,<first table name>,<second table name>
e.g:
intersection,Attendance,Grade
whereAttendance
is name of the first table andGrade
is name of the second table. -
Difference of two tables
difference,<first table name>,<second table name>
e.g:
difference,Attendance,Grade
whereAttendance
is name of the first table andGrade
is name of the second table -
Projection of a table on to a list of attributes (i.e. columns)
projection,<table name>,<list of column names>
e.g:
projection,Attendance,Name
whereAttendance
is the table name andName
is columns list with single column names.More column names can be specified in the columns list
-
Select a row from a table with a given value for a column
select,<table name>,<column name>,<value>
e.g:
select,Attendance,Age,25
whereAttendance
is name of the table to select from,Age
is the column used for selection and25
is the value at the selection column. -
Natural Join of the two tables
Njoin,<first table name>,<second table name>
e.g:
Njoin,Attendance,Grade
whereAttendance
is name of the first table andGrade
is name of the second table. -
Clear screen
cls
-
Exit the program
exit
Perform the following steps at the shell prompt:
cd /to/project/root_dir
mkdir build
cd build
cmake ..
make -j
sudo make install