Skip to content
This repository has been archived by the owner on Oct 31, 2019. It is now read-only.

Object oriented relational database system #17

Open
1 of 4 tasks
Ram-Aditya opened this issue Oct 2, 2018 · 4 comments
Open
1 of 4 tasks

Object oriented relational database system #17

Ram-Aditya opened this issue Oct 2, 2018 · 4 comments
Labels
hacktoberfest Open issues for hacktoberfest intermediate Intermediate Issue systems Systems related Issues

Comments

@Ram-Aditya
Copy link
Collaborator

Ram-Aditya commented Oct 2, 2018

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:

    • You must use any one of the following programming languages: Python, Java, C, C++.
  • 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:

    • While making the Pull Request, attach screenshots of 5 sample inputs and their corresponding output.

Issue requirements / progress

  • Python
  • C++
  • Java
  • 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.

@mahim23 mahim23 added hacktoberfest Open issues for hacktoberfest systems Systems related Issues labels Oct 5, 2018
@aditigupta17 aditigupta17 added the intermediate Intermediate Issue label Oct 6, 2018
@andymac-2
Copy link
Contributor

Can I take this one on in C?

@mahim23
Copy link
Collaborator

mahim23 commented Oct 6, 2018

@andymac-2 sure you can start working on it.

@andymac-2
Copy link
Contributor

This is taking a little longer than I expected, but I should be done by tomorrow about this time.

@Ram-Aditya
Copy link
Collaborator Author

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
hacktoberfest Open issues for hacktoberfest intermediate Intermediate Issue systems Systems related Issues
Projects
None yet
Development

No branches or pull requests

4 participants