Welcome to the NECTA Tanzania Results Database project. This repository contains PostgreSQL database dumps of the NECTA exam results. Currently, the available results are for CSEE from 2019 to 2023, with more results to be added weekly. The goal is to include all results from 2003 to 2023.
These instructions will help you set up and run the NECTA results database on your local machine or server.
- PostgreSQL (version 12 or later)
- Git
-
Clone the repository:
git clone https://github.com/web-team-cive/necta-postgres.git cd necta-postgres
-
Create a new PostgreSQL database:
createdb -U postgres necta_results
-
Restore the database from the dump file:
Navigate to the specific year and restore the corresponding dump file. For example, to restore the 2019 CSEE results:
cd csee/2019 pg_restore -U postgres -d necta_results 2019.dump
Repeat the above step for other years as needed.
The main table in the database is form_four
, which contains the following columns:
- regno (text): Registration number of the student
- gender (text): Gender of the student
- points (text): Points scored by the student
- division (text): Division classification of the results
- results (text): Detailed results of the student
- yr (text): Year of the exam
Once the database is restored, you can connect to it using any PostgreSQL client and query the results. Below is an example of how to connect and query the database using psql
:
-
Connect to the database:
psql -U postgres -d necta_results
-
Run a sample query:
SELECT * FROM form_four WHERE yr = '2019';
You can now develop your applications (websites or apps) to display NECTA results using this database. Here are a few steps to integrate the database with your application:
-
Database Connection:
Establish a connection to the PostgreSQL database from your application using the appropriate database driver or ORM (Object-Relational Mapping) for your programming language. Ensure you use the correct connection parameters (database name, user, password, host, port).
-
Querying the Database:
Write SQL queries to fetch the results from the database tables. For example, to fetch all results for a particular year, you might query the
form_four
table. -
Displaying Results:
Format and display the results in your application's user interface. Ensure that the data is presented in a user-friendly manner.
-
Example Code:
Here's an example of how you might connect to the database and query it using Python and the
psycopg2
library:import psycopg2 try: connection = psycopg2.connect( database="necta_results", user="postgres", password="yourpassword", host="127.0.0.1", port="5432" ) cursor = connection.cursor() cursor.execute("SELECT * FROM form_four WHERE yr = '2019';") results = cursor.fetchall() for row in results: print(row) except Exception as error: print(f"Error: {error}") finally: if connection: cursor.close() connection.close()
We welcome contributions! If you have additional NECTA results or improvements, please fork the repository and create a pull request.
This project is licensed under the MIT License.
- NECTA for providing the exam results.
- All contributors who have helped in creating and maintaining this project.
For any questions or support, please open an issue in the repository or contact the maintainers directly.
Note: This repository is intended for educational and informational purposes only. Please ensure compliance with any relevant legal and privacy requirements when using the data.