A Comprehensive Guide to SQLite: Installation, Checking, and Deleting Records

# 📚 SQLite Guide: Installation, Checking, and Deleting Records

## 1. Install SQLite 🛠️

To get started with SQLite, you'll need to install it on your system. Follow these steps:

### For Debian/Ubuntu:

1. **Open Terminal** 🖥️
2. **Update Package List**:
   ```bash
   sudo apt update
  1. Install SQLite:
    sudo apt install sqlite3
    
  2. Verify Installation ✅:
    sqlite3 --version
    

2. Open Your Database 📂

Once SQLite is installed, you can open your database file:

  1. Navigate to the Directory:
    cd ~/appdata/arrr/jellyseerr/db
    
  2. Open SQLite with Your Database:
    sqlite3 db.sqlite3
    

3. Check for Existing Records 🔍

Before deleting any records, it’s good practice to check if they exist.

Run the Following Query:

SELECT media_request.id 
FROM media 
LEFT JOIN media_request ON media.id = media_request.mediaId 
WHERE media.status = 5;

Interpreting the Results:

  • The output will show IDs of media_request records that are linked to media entries with a status of 5.
  • Example Output:
    1
    3
    5
    7
    8
    9
    10
    11
    14
    15
    28
    

4. Delete Records 🗑️

If you confirmed that records exist, you can proceed to delete them.

Run the Following Query:

DELETE FROM media_request 
WHERE id IN (
    SELECT media_request.id 
    FROM media 
    LEFT JOIN media_request ON media.id = media_request.mediaId 
    WHERE media.status = 5
);

5. Confirm Deletion ✔️

After deleting, it’s important to verify that the records have been removed.

Run the Check Again:

SELECT media_request.id 
FROM media 
LEFT JOIN media_request ON media.id = media_request.mediaId 
WHERE media.status = 5;
  • If the result set is empty, the deletion was successful! 🎉

Conclusion 🎈

You have successfully installed SQLite, checked for existing records, and deleted them as needed. If you have more questions or need further assistance, feel free to ask!

e>