Open Ram-Aditya opened 6 years ago
Can I take this one on in C?
@andymac-2 sure you can start working on it.
This is taking a little longer than I expected, but I should be done by tomorrow about this time.
@andymac-2 Please try to submit by tomorrow else the implementation in C will have to be handed over to the next person who will request it.
Description
Implement a simple object-oriented relational database that can store and retrieve student details. The implementation consists of 4 steps.
1. Create classes/structures
You need to create a class/structure and add functionalities to the same, for the following Database entities:
Database: The Database class provides access to a collection of static data that are the global state of the database. This includes methods to access the catalog (the list of all the tables in the database), and the log file(whenever a request for data is given, record the timestamp and the data that was requested for and ID of the user).
Tuple: The class representing a row in a relation/table. This will hold the values of the attributes of the table to which this tuple belongs. Each tuple object must have a unique ID and the unique table ID to which it belongs.
Relation: The class representing a table. An object of type Relation is essentially a table whose collection of tuple objects are the set of rows of the table. Each relation object must have a unique tableID to identify it in the database.
Note: In C, you can use structures to implement the above.
2. Store data
Details of Table and Initial Data:
Table1/Relation1: StudentDetails (Name, Department, CGPA(0-10), RollNo(Unique Integer), Graduation_Year(2018-2022))
Table2/Relation2: MarksDetails (Student_RollNo, Subject1_Marks(0-100), Subject2_Marks(0-100), Subject3_Marks(0-100))
The range of values given in the bracket after the attribute name represents the valid range of values that the attribute value must belong to.
After designing the classes, create 2 CSV files which contain data for Table1/Relation1 and Table2/Relation2. File1 contains the values for the StudenDetails table for 1000 students. File2 contains the details of marks scored in 3 subjects for each student in Table1. Make sure that every student in Table1 has a corresponding entry in Table2. These 2 files must be Initialized with random values appropriately for each of attributes.
Using the classes that were previously implemented, parse data from the 2 CSV files into 2 corresponding Table/Relation objects/structs.
3. Retrieval of Data
You need to add functionality to implement the following SQL command:
SELECT col_name1, col_name2,... FROM table_name LIMIT n ;
This is used to display the values stored in the mentioned columns for n students. Use the col_name1, col_name2, etc and table_name strings given as part of the input-command to match and retrieve the correct values from the database. Present a neat grid-style output.
4. Performing I/O
Once the program is loaded and the CSV files have been parsed and stored into appropriate objects, ask the user to provide their user-ID (this can be any random integer value and will be used for logging). The user can now input a command such as:
SELECT Name, RollNo FROM StudentDetails LIMIT 10 ;
The expected output is the list of Name and RollNo. of 10 students.
Keep taking command input until the user enters: EXIT.
Details
Technical Specifications:
Type of issue: No more than one implementation will be accepted for each language. Once the implementation for a language has been taken up (i.e if it is checked in the 'Issue Progress' section), you must choose from the remaining.
Time Limit: Issues will be given on a first-come, first-serve basis. Once you take this issue up, you must complete it within 4 days, failing which the issue will be allocated to the next person who requested for this issue.
Additional Instructions:
Issue requirements / progress
[ ] Python
[ ] C++
[ ] Java
[x] C
Resources
https://www.w3schools.com/sql/ https://www.tutorialspoint.com/sql/sql-rdbms-concepts.htm
Directory Structure
For this issue, use the following directory of the Hacktoberfest-2k18 repository:
/systems/dbms/simple_object_oriented/language_name
(where language_name is one of the languages mentioned above.) You may add subdirectories under this if you want to organize your CSV files and program files.
Note
Please claim the issue first by commenting here before starting to work on it.