skip to Main Content

So I have a table in my SQL and it saves ServerID from discord, now like 500 users verified and on the table it says like ServerID: 123 User: Test
Now I accidentally I have deleted the server on dashboard and all things with the server id 123 have been deleted, I have made a backup earlier, now my question is can I do it like I only search id 123 can download only the strings with it and add it to my old database? Thanks!

3

Answers


  1. Standard query language (SQL) makes this beautifully simple to do.

    SELECT * FROM table WHERE id = 123;

    Explain

    The SELECT portion indicates you wish to select/inspect a given record.

    The * indicates that you wish to select all records.

    The FROM indicates the desired table – and lowercase table indicates the table name. The table will need to be customized to your environment.

    The WHERE is your filter and indicates what type of wheres to search.

    The id = 123 is restricting your WHERE to results when the keyword id is equal to 123

    You should finish all SQL queries with a semicolon. This is language syntax, but may not be required depending on your interface.

    Login or Signup to reply.
  2. I would load the entire SQL file to a new database (you’ll want to open the SQL file in a text editor to search and replace any references to the old database name; not all database dumps will contain the database name but if it does, you don’t want to accidentally import to the wrong database).

    Once you have the new database, it’s relatively simple to search across all tables for the rows that reference the id 123 and either manually or programmatically replicate that back to the original database.

    Login or Signup to reply.
  3. There are 2 ways to recover it.

    1. You have to restore the backup and then grab the required string and then later on delete the unnecessary data.
    2. Open the file via a text editor, use ctrl+f to find the required string and then insert/update it in your database via SQL query.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search