marriage bureau project
marriage bureau project
marriage bureau project
PUBLIC SR.SEC
SCHOOL
COMPUTER SCIENCE
PROJECT FILE
Marriage Bureau
RAGHAV ,HARSH AND
JUNAID
XII-COMMERCE ‘A’
1
ACKNOWLEDGEMENT
2
TABLE OF CONTENTS:
01. Introduction
04. Output
3
INTRODUCTION
Welcome to the Marriage Bureau System – a digital service designed
to simplify the process of finding life partners. This project is a
marriage of technology and human connection, aimed at helping
individuals discover their ideal match.
The Project is entirely coded in python and SQL. And uses both of
them together to form a smooth seamless technology that lets a user to
Create Profile, update, delete or search for the profile in the database
and even create a match for 2 profiles.
Technologies Used:
In simple words, learning Python in Class 12th isn't just about coding.
It's about gaining the power to turn ideas into real things.
4
2. SQL: Structured Query Language facilitates seamless interaction
with the database.
How It Works:
5
Income, their height, preferences while choosing a partner,
educational qualification and much more.
-Data Deletion: The data can also be deleted in a similar fashion, one
can search for the data to be deleted and then can delete the data
accordingly.
1. Database Setup:
- Run the "Create Table.py" Python script to set up the initial
database tables. This script prompts you to enter the MySQL database
password. If the database does not exist, it will be created.
3. User Registration:
- Choose the option to "Add User Details" from the main menu.
Follow the prompts to input login credentials, career details, personal
information, and preferences. This information is stored in the
corresponding database tables.
6
4. Match Registration:
- Opt for the "Add Match" option to register a match between two
users. Input the user IDs, match status, and the date of the match. The
match details are stored in the "Matches" table.
5. Data Display:
- Use the "Display Data" option to view information from different
tables. Select the table you want to display, and the program fetches
and presents the data in a tabular format.
6. Data Update:
- Select the "Update Data" option to modify existing records.
Choose the table and column you wish to update, provide the User ID,
and enter the new value. The updated data is then reflected in the
database.
7. Data Search:
- Utilize the "Search Data" option to find specific records. You can
search by User ID or First Name, depending on your preference. The
program displays the relevant information if a match is found.
8. Data Deletion:
- Choose the "Delete Data" option to remove a user's data along
with associated records in other tables. Enter the User ID, and the
program deletes all data linked to that user.
9. Application Exit:
- To exit the application, select the "Exit" option from the main
menu. This gracefully concludes the program.
Important Notes:
- Ensure that the MySQL server is running before executing the
scripts.
- Follow the on-screen instructions and input data accurately to
7
maintain data integrity.
- Password protection is critical for database access; ensure the
security of your MySQL password.
By following these steps, users can interact with the Marriage Bureau
application, register and manage user details, track matches, and
perform various database operations efficiently.
2. Cursor:
- Description: In database operations, a cursor is a control structure
that enables traversal over the records in a database.
- Significance in the Project: The `cursor` in the Marriage Bureau
project is crucial for executing SQL queries and fetching results from
the database.
8
5. DESCRIBE Statement:
- Description: The SQL `DESCRIBE` statement is used to retrieve
metadata about a table, such as column names and their data types.
- Significance in the Project: It assists in dynamically fetching
column names and their characteristics, aiding in various database
operations.
6. SELECT Statement:
- Description: The SQL `SELECT` statement is used to retrieve data
from one or more tables in a database.
- Significance in the Project: It is employed to fetch and display data
from different tables, providing valuable insights and information.
7. UPDATE Statement:
- Description: The SQL `UPDATE` statement is used to modify
existing records in a table.
- Significance in the Project: It allows users to update their data,
ensuring the accuracy and relevance of information in the Marriage
Bureau database.
8. DELETE Statement:
- Description: The SQL `DELETE` statement is used to remove
records from a table.
- Significance in the Project: This statement is employed in
functions like deleting user data, ensuring data hygiene and user
privacy.
9
List of Functions:
1. `DataBaseCreation`
2. `TablesCreation`
3. `testing`
4. `add_user_details`
5. `add_match`
6. `update_data`
7. `search_data`
8. `delete_user_data`
9. `get_table_names`
10. `display_data`
11. `main_menu`
List of Tables:
1. `LoginDetails`
2. `CareerProfile`
3. `PersonalDetails`
4. `PreferenceDetails`
5. `Matches`
10
12. `results` - List of Tuples
SQL Data Types:
1. LoginDetails Table:
- `UserId` - INT(5)
- `Email` - VARCHAR(255)
- `PhoneNumber` - VARCHAR(20)
- `Password` - VARCHAR(255)
- `FullName` - VARCHAR(255)
2. CareerProfile Table:
- `UserId` - INT(5)
- `EducationalQualification` - VARCHAR(255)
- `Profession` - VARCHAR(255)
- `AnnualIncome` - DECIMAL(10, 2)
- `Location` - VARCHAR(255)
- `JobDescription` - TEXT
3. PersonalDetails Table:
- `UserId` - INT(5)
- `FirstName` - VARCHAR(255)
- `LastName` - VARCHAR(255)
- `Age` - INT
- `Gender` - VARCHAR(10)
- `Religion` - VARCHAR(255)
- `ZodiacSign` - VARCHAR(20)
- `Location` - VARCHAR(255)
- `Height` - INT
- `Description` - TEXT
- `Interests` - TEXT
- `MotherTongue` - VARCHAR(255)
4. PreferenceDetails Table:
- `UserId` - INT(5)
- `Religion` - VARCHAR(255)
- `MinAge` - INT
- `MaxAge` - INT
11
- `Location` - VARCHAR(255)
- `Profession` - VARCHAR(255)
- `EducationalQualification` - VARCHAR(255)
- `ZodiacSign` - VARCHAR(20)
5. Matches Table:
- `MatchId` - INT(5)
- `UserId` - INT(5)
- `PartnerID` - INT(5)
- `Status` - VARCHAR(50)
- `DateOfMatch` - DATE
12
EducationalQualification
VARCHAR(255),
Profession VARCHAR(255),
AnnualIncome DECIMAL(10, 2),
Location VARCHAR(255),
JobDescription TEXT,
FOREIGN KEY (UserId) REFERENCES
LoginDetails(UserId)
)
""")
cursor.execute("""
CREATE TABLE IF NOT EXISTS
PersonalDetails (
UserId INT(5) PRIMARY KEY,
FirstName VARCHAR(255) NOT NULL,
LastName VARCHAR(255) NOT NULL,
Age INT,
Gender VARCHAR(10),
Religion VARCHAR(255),
ZodiacSign VARCHAR(20),
Location VARCHAR(255),
Height INT,
Description TEXT,
Interests TEXT,
MotherTongue VARCHAR(255),
FOREIGN KEY (UserId) REFERENCES
LoginDetails(UserId)
)
""")
# PreferenceDetails Table
cursor.execute("""
CREATE TABLE IF NOT EXISTS
PreferenceDetails (
UserId INT(5) PRIMARY KEY,
Religion VARCHAR(255),
MinAge INT,
MaxAge INT,
Location VARCHAR(255),
Profession VARCHAR(255),
EducationalQualification
VARCHAR(255),
ZodiacSign VARCHAR(20),
13
FOREIGN KEY (UserId) REFERENCES
LoginDetails(UserId)
)
""")
# Matches Table
cursor.execute("""
CREATE TABLE IF NOT EXISTS Matches (
MatchId INT(5) PRIMARY KEY
AUTO_INCREMENT,
UserId INT(5),
PartnerID INT(5),
Status VARCHAR(50),
DateOfMatch DATE,
FOREIGN KEY (UserId) REFERENCES
LoginDetails(UserId),
FOREIGN KEY (PartnerID) REFERENCES
PersonalDetails(UserId)
)
""")
cursor.execute(f"""
INSERT INTO LoginDetails (Email,
PhoneNumber, Password, FullName)
VALUES ('{email}', '{phone_number}',
'{password}', '{full_name}')
""")
mydb.commit()
14
print("LoginDetails Added Successfully. \n")
print("\nNow You will be asked to Enter
Details for your Career Description: \n")
cursor.execute(f"""
INSERT INTO CareerProfile
VALUES ({user_id},
'{educational_qualification}', '{profession}',
{annual_income},
'{location}',
'{job_description}')
""")
mydb.commit()
print("\nCareerProfile Added Successfully.\
n")
print("\nNow you will be asked to enter your
Personal Details.\n")
cursor.execute(f"""
INSERT INTO PersonalDetails
15
VALUES ({user_id}, '{first_name}',
'{last_name}', {age}, '{gender}', '{religion}',
'{zodiac_sign}', '{location}',
{height},
'{description}', '{interests}',
'{mother_tongue}')
""")
mydb.commit()
print("\nPersonalDetails Added Successfully.\
n")
print("\nYour Profile is Created !\nNow you
will be asked to Enter the Details for your
Preferences! .\n")
cursor.execute(f"""
INSERT INTO PreferenceDetails
VALUES ({user_id}, '{religion}',
{min_age}, {max_age}, '{location}',
'{profession}',
'{educational_qualification}', '{zodiac_sign}')
""")
mydb.commit()
print("\nPreferenceDetails Added
Successfully.!!\n")
except Exception as e:
print(f"\n\nFailed to Add User Details.
Error: {e}")
def add_match():
try:
user_id = int(input("Enter User ID:"))
partner_id = int(input("Enter Partner ID:"))
status = input("Enter Status:")
16
date_of_match = input("Enter Date of Match
(YYYYMMDD):")
cursor.execute(f"""
INSERT INTO Matches
VALUES (NULL, {user_id}, {partner_id},
'{status}', '{date_of_match}')
""")
mydb.commit()
print("\nMatches Added Successfully.\n")
except Exception as e:
print(f"\n\nFailed to Add Matches. Error:
{e}")
def update_data():
try:
# Display available tables
table_names = get_table_names() # A function
to Get a type list of the Names of All the Tables
from the Schema
print("Available tables:")
columns = cursor.fetchall()
column_names = [column[0] for column in
columns] # 0th Column of Every Row is Being Fetched
17
# Exclude User ID from the list of columns as
User Id should not be updated by a User
column_names_exclude_id = [name for name in
column_names if name.lower() != 'userid']
except Exception as e:
18
print(f"Failed to update data. Error: {e}")
def search_data():
try:
print("Search Options:")
print("1. Search by UserId")
print("2. Search by First Name")
if search_option == '1':
primary_key_column = "UserId"
primary_key_value = int(input(f"Enter
{primary_key_column} to search:"))
elif search_option == '2':
primary_key_column = "FirstName" #
Assuming the column name is FirstName in the
PersonalDetails table
primary_key_value = input(f"Enter
{primary_key_column} to search:")
else:
print("Invalid choice. Please enter
either 1 or 2.")
return
cursor.execute(f"DESCRIBE PersonalDetails")
columns = cursor.fetchall()
column_names = [column[0] for column in
columns]
cursor.execute(f"SELECT * FROM
PersonalDetails WHERE
{primary_key_column}='{primary_key_value}'")
results = cursor.fetchall()
if results:
print(f"\nSearch results for
{primary_key_column}={primary_key_value}:\n")
else:
print(f"No results found for
{primary_key_column}={primary_key_value}")
except Exception as e:
print(f"Failed to search data. Error: {e}")
def delete_user_data(user_id):
try:
# Delete data from Matches table
cursor.execute(f"DELETE FROM Matches WHERE
UserId={user_id} OR PartnerID={user_id}")
mydb.commit()
20
# Delete data from CareerProfile table
cursor.execute(f"DELETE FROM CareerProfile
WHERE UserId={user_id}")
mydb.commit()
def get_table_names():
cursor.execute("SHOW TABLES")
tables = cursor.fetchall()
table_names = [table[0] for table in tables]
table_names = [table_name for table_name in
table_names if table_name != 'logindetails'] #
Exclude LoginDetails table
return table_names
def display_data():
try:
table_names = get_table_names()
print("Available tables:")
for i, table_name in enumerate(table_names,
1):
print(f"{i}. {table_name}")
21
cursor.execute(f"DESCRIBE
{selected_table}")
columns = cursor.fetchall()
column_names = [column[0] for column in
columns]
# Display data
cursor.execute(f"SELECT * FROM
{selected_table}")
results = cursor.fetchall()
for row in results:
print(" | ".join(map(str, row)))
print("-" * 30)
else:
print("LoginDetails table cannot be
displayed.")
except Exception as e:
print(f"Unable to fetch data. Error: {e}")
def main_menu():
while True:
print("\nMain Menu:")
print("1. Add User Details")
print("2. Add Match")
print("3. Display Data")
print("4. Update Data")
print("5. Search Data")
print("6. Delete Data")
print("7. Exit")
if choice == '1':
add_user_details()
elif choice == '2':
add_match()
elif choice == '3':
display_data()
22
elif choice == '4':
update_data()
elif choice == '5':
search_data()
elif choice == '6':
user_id_to_delete = int(input("Enter User
ID to delete all associated data: "))
delete_user_data(user_id_to_delete)
elif choice == '7':
break
else:
print("Invalid choice. Please enter a
number between 1 and 7.")
main_menu()
23
24
25
DISPLAY
UPDATE
26
SEARCH
DELETE
27