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
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 lowercasetable
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 yourWHERE
to results when the keywordid
is equal to123
You should finish all SQL queries with a semicolon. This is language syntax, but may not be required depending on your interface.
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.
There are 2 ways to recover it.