This repository contains SQL and Python scripts used for querying, inserting, and transferring data into the Sikorsky Archives database. These scripts are part of an internship project focused on managing and retrieving historical data related to Sikorsky Aircraft.
During my internship at Sikorsky Archives, I developed these scripts to help address various challenges related to creating and managing a database. The scripts serve multiple purposes, including:
- Demonstrating how to create and manipulate database entries.
- Showing methods for exporting and importing data.
- Providing tools for searching and retrieving specific data.
These scripts are intended to be deposited as part of my work, to assist with ongoing and future efforts in managing the Sikorsky Archives database.
The repository includes the following files:
- Example_selects.sql: SQL script containing sample SELECT queries to retrieve data from the
Aircraft
andEngineers
tables. - Example_inserts.sql: SQL script containing sample INSERT statements to add new records to the
Aircraft
andEngineers
tables. - Query.py: Python script that connects to an SQLite database and runs a specified SQL query.
- transfer_script.py: Python script that transfers data from Excel sheets to a MySQL database, creating necessary tables and inserting data into them.
To use the scripts in this repository, you need to have SQLite, Python, MySQL, and the necessary Python libraries installed on your system.
-
SQLite:
- Download and install SQLite from the official website.
-
Python:
- Download and install Python from the official website.
-
MySQL:
- Download and install MySQL from the official website.
-
Python Libraries:
- Install the required Python libraries using pip:
pip install pymysql openpyxl
- Install the required Python libraries using pip:
-
Running SELECT Queries:
- Open your terminal or command prompt.
- Navigate to the directory containing
Example_selects.sql
. - Use the SQLite command line tool to execute the script:
sqlite3 sikorsky_archives.db < Example_selects.sql
-
Running INSERT Statements:
- Open your terminal or command prompt.
- Navigate to the directory containing
Example_inserts.sql
. - Use the SQLite command line tool to execute the script:
sqlite3 sikorsky_archives.db < Example_inserts.sql
- Running the Python Script:
- Open your terminal or command prompt.
- Navigate to the directory containing
Query.py
. - Run the script using Python:
python Query.py
-
Setting Up the MySQL Database:
- Ensure MySQL is running and you have created a database (e.g.,
first_sikorsky
). - Update the database connection parameters in the
transfer_script.py
to match your MySQL setup.
- Ensure MySQL is running and you have created a database (e.g.,
-
Running the Transfer Script:
- Open your terminal or command prompt.
- Navigate to the directory containing
transfer_script.py
. - Run the script using Python:
python transfer_script.py
The script will create the necessary tables and insert data from the specified Excel files into the MySQL database.