-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdelete_all_data.sql
41 lines (31 loc) · 1.04 KB
/
delete_all_data.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
-- Deleting All Data from Tables
-- Delete all records from the Loans table
DELETE FROM Loans;
-- Alternatively, you can use TRUNCATE for faster deletion without logging individual row deletions
-- TRUNCATE TABLE Loans;
-- Delete all records from the BookGenre table
DELETE FROM BookGenre;
-- TRUNCATE TABLE BookGenre;
-- Delete all records from the BookAuthor table
DELETE FROM BookAuthor;
-- TRUNCATE TABLE BookAuthor;
-- Delete all records from the Books table
DELETE FROM Books;
-- TRUNCATE TABLE Books;
-- Delete all records from the Genres table
DELETE FROM Genres;
-- TRUNCATE TABLE Genres;
-- Delete all records from the Authors table
DELETE FROM Authors;
-- TRUNCATE TABLE Authors;
-- Delete all records from the Administrators table
DELETE FROM Administrators;
-- TRUNCATE TABLE Administrators;
-- Delete all records from the Borrowers table
DELETE FROM Borrowers;
-- TRUNCATE TABLE Borrowers;
-- Delete all records from the Users table
DELETE FROM Users;
-- TRUNCATE TABLE Users;
-- Commit the deletions to make sure all changes are saved
COMMIT;