{"id":4248,"date":"2023-11-07T10:35:09","date_gmt":"2023-11-07T05:05:09","guid":{"rendered":"https:\/\/cbsepython.in\/?p=4248"},"modified":"2023-11-07T10:41:03","modified_gmt":"2023-11-07T05:11:03","slug":"marriage-bureau-management-system-in-python","status":"publish","type":"post","link":"https:\/\/cbsepython.in\/marriage-bureau-management-system-in-python\/","title":{"rendered":"Marriage Bureau Management System in Python Project for Class 12"},"content":{"rendered":"<h2><span style=\"color: #000000;\">Marriage Bureau Management System in Python<\/span><\/h2>\n<p><span style=\"color: #000000;\">This project is a simplified version of a <strong>Marriage Bureau Management System in Python<\/strong>, and it covers the basics of working with a MySQL database. Let&#8217;s break it down into key components:<\/span><\/p>\n<ol>\n<li><span style=\"color: #000000;\"><strong> Database Setup:<\/strong><\/span><\/li>\n<\/ol>\n<ul>\n<li><span style=\"color: #000000;\">A database is like a structured Excel sheet that stores information. In this project, we use MySQL, a popular database system.<\/span><\/li>\n<li><span style=\"color: #000000;\">We set up a database called &#8220;marriage_bureau_management&#8221; to store information about users and customers looking for marriage partners.<\/span><\/li>\n<\/ul>\n<ol start=\"2\">\n<li><span style=\"color: #000000;\"><strong> User Registration and Login:<\/strong><\/span><\/li>\n<\/ol>\n<ul>\n<li><span style=\"color: #000000;\">Users (people looking for marriage partners) can register with a username and password. This information is stored in the &#8220;user_id&#8221; table.<\/span><\/li>\n<li><span style=\"color: #000000;\">Users can log in using their registered username and password. If they provide the correct details, they can access the system.<\/span><\/li>\n<\/ul>\n<ol start=\"3\">\n<li><span style=\"color: #000000;\"><strong> Customer Details:<\/strong><\/span><\/li>\n<\/ol>\n<ul>\n<li><span style=\"color: #000000;\">Users can add details about people who are looking for marriage partners. This includes their name, address, caste, appearance, age, profession, and phone number.<\/span><\/li>\n<li><span style=\"color: #000000;\">This information is stored in the &#8220;customer_details&#8221; table.<\/span><\/li>\n<\/ul>\n<ol start=\"4\">\n<li><span style=\"color: #000000;\"><strong> Searching for Matches:<\/strong><\/span><\/li>\n<\/ol>\n<ul>\n<li><span style=\"color: #000000;\">Users can search for potential matches based on two criteria: profession and appearance.<\/span><\/li>\n<li><span style=\"color: #000000;\">If you&#8217;re looking for someone with a specific job (like a doctor or engineer), you can search for matches by their profession.<\/span><\/li>\n<li><span style=\"color: #000000;\">If you&#8217;re looking for someone who looks a certain way (beautiful, handsome, etc.), you can search for matches by their appearance.<\/span><\/li>\n<li><span style=\"color: #000000;\">The system will display matching profiles based on the criteria you provide.<\/span><\/li>\n<\/ul>\n<ol start=\"5\">\n<li><span style=\"color: #000000;\"><strong> Menu and Interaction:<\/strong><\/span><\/li>\n<\/ol>\n<ul>\n<li><span style=\"color: #000000;\">The project provides a simple menu for users with options like registration, login, adding customer details, and searching for matches.<\/span><\/li>\n<li><span style=\"color: #000000;\">Users can choose from these options and interact with the system.<\/span><\/li>\n<\/ul>\n<ol start=\"6\">\n<li><span style=\"color: #000000;\"><strong> Error Handling:<\/strong><\/span><\/li>\n<\/ol>\n<ul>\n<li><span style=\"color: #000000;\">The project includes some basic error handling to check for duplicate user registrations and provides feedback to the user.<\/span><\/li>\n<\/ul>\n<ol start=\"7\">\n<li><span style=\"color: #000000;\"><strong> Database Interaction:<\/strong><\/span><\/li>\n<\/ol>\n<ul>\n<li><span style=\"color: #000000;\">The program interacts with the MySQL database using Python. It uses SQL queries to store and retrieve data.<\/span><\/li>\n<\/ul>\n<ol start=\"8\">\n<li><span style=\"color: #000000;\"><strong> Structure:<\/strong><\/span><\/li>\n<\/ol>\n<ul>\n<li><span style=\"color: #000000;\">The code is organized into functions, which makes it easier to understand and maintain. Functions like &#8220;register_user&#8221; and &#8220;login_user&#8221; handle specific tasks.<\/span><\/li>\n<\/ul>\n<p><span style=\"color: #000000;\">This project is a simplified example of a larger system that a marriage bureau might use to manage profiles and match potential partners. It&#8217;s designed to help students learn the basics of database interaction, user authentication, and data retrieval.<\/span><\/p>\n<p><span style=\"color: #000000;\">Students can explore and expand on this project by adding more features, improving the user interface, and enhancing the database structure to make it more practical and robust.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span style=\"color: #000000;\"><strong>Marriage Bureau Management System in Python <\/strong>Source Code:<\/span><\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import mysql.connector as sql\r\n\r\n# Connect to the MySQL database\r\nconn = sql.connect(host='localhost', user='root', password='admin')\r\n\r\nc1 = conn.cursor()\r\nc1.execute(\" create database if not exists marriage_bureau_management\")\r\nc1.execute(\"use marriage_bureau_management\")\r\n\r\ndef create_tables():\r\n    # Create tables for customer details and user accounts\r\n    c1.execute('''\r\n        CREATE TABLE IF NOT EXISTS user_id (\r\n            id INT AUTO_INCREMENT PRIMARY KEY,\r\n            user_name VARCHAR(255),\r\n            password VARCHAR(255)\r\n        )\r\n    ''')\r\n\r\n    c1.execute('''\r\n        CREATE TABLE IF NOT EXISTS customer_details (\r\n            id INT AUTO_INCREMENT PRIMARY KEY,\r\n            name VARCHAR(200),\r\n            address VARCHAR(100),\r\n            caste VARCHAR(100),\r\n            appearance VARCHAR(100),\r\n            age INT,\r\n            profession VARCHAR(255),\r\n            phone_no BIGINT\r\n        )\r\n    ''')\r\n\r\n    conn.commit()\r\n\r\ndef register_user():\r\n    name = input('Enter your Username: ')\r\n    passwd = input('Enter your Password (only numbers): ')\r\n\r\n    # Insert user data into the 'user_id' table using a parameterized query\r\n    sql_insert = \"INSERT INTO user_id (user_name, password) VALUES (%s, %s)\"\r\n    user_data = (name, passwd)\r\n\r\n    try:\r\n        c1.execute(sql_insert, user_data)\r\n        conn.commit()\r\n        print('User created successfully')\r\n    except sql.IntegrityError as e:\r\n        print('User already exists.')\r\n\r\ndef login_user():\r\n    name = input('Enter your Username: ')\r\n    passwd = input('Enter your Password: ')\r\n\r\n    # Select user data from the 'user_id' table using a parameterized query\r\n    sql_select = \"SELECT * FROM user_id WHERE user_name = %s AND password = %s\"\r\n    user_data = (name, passwd)\r\n\r\n    c1.execute(sql_select, user_data)\r\n    result = c1.fetchone()\r\n\r\n    if result:\r\n        print('Login successful')\r\n        return result[0]  # Return the user's ID\r\n    else:\r\n        print('Invalid username or password')\r\n        return None\r\n\r\ndef add_customer_details():\r\n    name = input('Enter the name: ')\r\n    address = input('Enter the address: ')\r\n    caste = input('Enter the caste: ')\r\n    appearance = input('Enter the appearance: ')\r\n    age = int(input('Enter the age: '))\r\n    profession = input('Enter the profession: ')\r\n    phone_no = int(input('Enter the phone number: '))\r\n\r\n    # Insert customer data into the 'customer_details' table using a parameterized query\r\n    sql_insert = \"INSERT INTO customer_details (name, address, caste, appearance, age, profession, phone_no) VALUES (%s, %s, %s, %s, %s, %s, %s)\"\r\n    customer_data = (name, address, caste, appearance, age, profession, phone_no)\r\n\r\n    try:\r\n        c1.execute(sql_insert, customer_data)\r\n        conn.commit()\r\n        print('Customer details added successfully')\r\n    except Exception as e:\r\n        print('Error:', e)\r\n\r\ndef search_matches_by_profession(profession):\r\n    # Select customer data from the 'customer_details' table based on the profession\r\n    sql_select = \"SELECT * FROM customer_details WHERE profession = %s\"\r\n    c1.execute(sql_select, (profession,))\r\n    results = c1.fetchall()\r\n\r\n    if results:\r\n        print(\"Matching customers:\")\r\n        for result in results:\r\n            print(result)\r\n    else:\r\n        print('No matching customers found.')\r\n\r\ndef search_matches_by_appearance(appearance):\r\n    # Select customer data from the 'customer_details' table based on appearance\r\n    sql_select = \"SELECT * FROM customer_details WHERE appearance = %s\"\r\n    c1.execute(sql_select, (appearance,))\r\n    results = c1.fetchall()\r\n\r\n    if results:\r\n        print(\"Matching customers:\")\r\n        for result in results:\r\n            print(result)\r\n    else:\r\n        print('No matching customers found.')\r\n\r\ndef main_menu():\r\n    print('*****************************************************MARRIAGE BUREAU MANAGEMENT**************************************************')\r\n    print('1. Register')\r\n    print('2. Login')\r\n    print('3. Add Customer Details')\r\n    print('4. Search Matches by Profession')\r\n    print('5. Search Matches by Appearance')\r\n    print('6. Exit')\r\n\r\n    while True:\r\n        choice = int(input('Enter your choice:'))\r\n\r\n        if choice == 1:\r\n            register_user()\r\n        elif choice == 2:\r\n            user_id = login_user()\r\n            if user_id is not None:\r\n                # You can add more functionality for logged-in users here\r\n                pass\r\n        elif choice == 3:\r\n            add_customer_details()\r\n        elif choice == 4:\r\n            profession = input('Enter the profession to search: ')\r\n            search_matches_by_profession(profession)\r\n        elif choice == 5:\r\n            appearance = input('Enter the appearance to search: ')\r\n            search_matches_by_appearance(appearance)\r\n        elif choice == 6:\r\n            print('Exiting the program')\r\n            break\r\n        else:\r\n            print('Invalid choice')\r\n\r\nif __name__ == '__main__':\r\n    create_tables()\r\n    main_menu()\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h3><span style=\"color: #000000;\">Sample Output:<\/span><\/h3>\n<pre>*****************************************************MARRIAGE BUREAU MANAGEMENT**************************************************\r\n1. Register\r\n2. Login\r\n3. Add Customer Details\r\n4. Search Matches by Profession\r\n5. Search Matches by Appearance\r\n6. Exit\r\nEnter your choice: 1\r\nEnter your Username: John\r\nEnter your Password (only numbers): 12345\r\nUser created successfully\r\n\r\n*****************************************************MARRIAGE BUREAU MANAGEMENT**************************************************\r\n1. Register\r\n2. Login\r\n3. Add Customer Details\r\n4. Search Matches by Profession\r\n5. Search Matches by Appearance\r\n6. Exit\r\nEnter your choice: 2\r\nEnter your Username: John\r\nEnter your Password: 12345\r\nLogin successful\r\n\r\n*****************************************************MARRIAGE BUREAU MANAGEMENT**************************************************\r\n1. Register\r\n2. Login\r\n3. Add Customer Details\r\n4. Search Matches by Profession\r\n5. Search Matches by Appearance\r\n6. Exit\r\nEnter your choice: 3\r\nEnter the name: Alice\r\nEnter the address: 123 Main St\r\nEnter the caste: XYZ\r\nEnter the appearance: Beautiful\r\nEnter the age: 28\r\nEnter the profession: Engineer\r\nEnter the phone number: 1234567890\r\nCustomer details added successfully\r\n\r\n*****************************************************MARRIAGE BUREAU MANAGEMENT**************************************************\r\n1. Register\r\n2. Login\r\n3. Add Customer Details\r\n4. Search Matches by Profession\r\n5. Search Matches by Appearance\r\n6. Exit\r\nEnter your choice: 4\r\nEnter the profession to search: Engineer\r\nMatching customers:\r\n(2, 'Alice', '123 Main St', 'XYZ', 'Beautiful', 28, 'Engineer', 1234567890)\r\n\r\n*****************************************************MARRIAGE BUREAU MANAGEMENT**************************************************\r\n1. Register\r\n2. Login\r\n3. Add Customer Details\r\n4. Search Matches by Profession\r\n5. Search Matches by Appearance\r\n6. Exit\r\nEnter your choice: 5\r\nEnter the appearance to search: Beautiful\r\nMatching customers:\r\n(2, 'Alice', '123 Main St', 'XYZ', 'Beautiful', 28, 'Engineer', 1234567890)\r\n\r\n*****************************************************MARRIAGE BUREAU MANAGEMENT**************************************************\r\n1. Register\r\n2. Login\r\n3. Add Customer Details\r\n4. Search Matches by Profession\r\n5. Search Matches by Appearance\r\n6. Exit\r\nEnter your choice: 6\r\nExiting the program\r\n\r\n\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Marriage Bureau Management System in Python This project is a simplified version of a Marriage Bureau Management System in Python, and it covers the basics of working with a MySQL database. Let&#8217;s break it down into key components: Database Setup: A database is like a structured Excel sheet that stores information. In this project, we [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,20,43],"tags":[],"class_list":["post-4248","post","type-post","status-publish","format-standard","hentry","category-cbse-sample-papers-class-12","category-cbse-computer-science-with-python-class-12","category-python-projects"],"_links":{"self":[{"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/posts\/4248","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/comments?post=4248"}],"version-history":[{"count":0,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/posts\/4248\/revisions"}],"wp:attachment":[{"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/media?parent=4248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/categories?post=4248"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/tags?post=4248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}