Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database_Interaction script added #2922

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e81765a
Folder Locker and Hider script added
Kalivarapubindusree Aug 10, 2023
dd74c39
Create_And_Manage_Heroku_App added
Kalivarapubindusree Aug 10, 2023
9fca401
Filter_Text added
Kalivarapubindusree Aug 10, 2023
be54e99
Get_Content_From_Wikipedia added
Kalivarapubindusree Aug 10, 2023
dd335c4
Forced_Browse script added
Kalivarapubindusree Aug 10, 2023
4c809a0
OS_interaction script added
Kalivarapubindusree Aug 10, 2023
8da6e06
version_control_automation script added
Kalivarapubindusree Aug 10, 2023
ea8a3ac
Network_Monitor script added
Kalivarapubindusree Aug 10, 2023
ab8919d
Network_Monitoring script added
Kalivarapubindusree Aug 10, 2023
00d7660
Database_Interaction script added
Kalivarapubindusree Aug 10, 2023
5471fb2
Delete Create_And_Manage_Heroku_App.py
Kalivarapubindusree Aug 10, 2023
2aaf8d2
Delete README.md
Kalivarapubindusree Aug 10, 2023
26e66f4
Delete Filter_Text.py
Kalivarapubindusree Aug 10, 2023
0cbb629
Delete README.md
Kalivarapubindusree Aug 10, 2023
c5c8ec3
Delete Folder_locker_and_Hider .py
Kalivarapubindusree Aug 10, 2023
eb1da28
Delete README.md
Kalivarapubindusree Aug 10, 2023
2486232
Delete Forced_Browse.py
Kalivarapubindusree Aug 10, 2023
ae5179d
Delete README.md
Kalivarapubindusree Aug 10, 2023
aef1090
Delete Get_Content_From_Wikipedia.py
Kalivarapubindusree Aug 10, 2023
3060490
Delete README.md
Kalivarapubindusree Aug 10, 2023
2786c0d
Delete Network_Monitoring.py
Kalivarapubindusree Aug 10, 2023
21d2b2c
Delete README.md
Kalivarapubindusree Aug 10, 2023
ee5d496
Delete OS_interaction.py
Kalivarapubindusree Aug 10, 2023
77f242e
Delete README.md
Kalivarapubindusree Aug 10, 2023
7eca6fe
Delete README.md
Kalivarapubindusree Aug 10, 2023
28de39b
Delete version_control_automation_script.py
Kalivarapubindusree Aug 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions Database_Interaction/Databse_Interaction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import sqlite3

def create_table(connection):
cursor = connection.cursor()
cursor.execute('''CREATE TABLE IF NOT EXISTS employees (
id INTEGER PRIMARY KEY,
name TEXT,
position TEXT,
salary REAL
)''')
connection.commit()

def insert_data(connection, name, position, salary):
cursor = connection.cursor()
cursor.execute("INSERT INTO employees (name, position, salary) VALUES (?, ?, ?)",
(name, position, salary))
connection.commit()

def update_salary(connection, employee_id, new_salary):
cursor = connection.cursor()
cursor.execute("UPDATE employees SET salary = ? WHERE id = ?", (new_salary, employee_id))
connection.commit()

def query_data(connection):
cursor = connection.cursor()
cursor.execute("SELECT * FROM employees")
rows = cursor.fetchall()

print("\nEmployee Data:")
for row in rows:
print(f"ID: {row[0]}, Name: {row[1]}, Position: {row[2]}, Salary: {row[3]}")

if __name__ == "__main__":
database_name = "employee_database.db"

connection = sqlite3.connect(database_name)
print(f"Connected to {database_name}")

create_table(connection)

insert_data(connection, "John Doe", "Software Engineer", 75000.0)
insert_data(connection, "Jane Smith", "Data Analyst", 60000.0)

print("\nAfter Insertions:")
query_data(connection)

update_salary(connection, 1, 80000.0)

print("\nAfter Update:")
query_data(connection)

connection.close()
print(f"Connection to {database_name} closed.")
16 changes: 16 additions & 0 deletions Database_Interaction/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Database_Interaction

Short description of package/script

- This Script Was simple to setup
- Need import sqlite3


## Setup instructions


Just Need to run this command "pip install sqlite3" then run Databse_Interaction.py file and for running python3 is must be installed!

## Detailed explanation of script, if needed

This Script Is Only for Database_Interaction use only!