-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeleteSQL.java
More file actions
71 lines (53 loc) · 2.31 KB
/
Copy pathDeleteSQL.java
File metadata and controls
71 lines (53 loc) · 2.31 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import java.sql.*;
import java.util.Scanner;
public class DeleteSQL{
Scanner sc = new Scanner(System.in);
private Connection conn;
public DeleteSQL() throws SQLException{
//MUST UPDATE BELOW WITH YOUR CLASS LINK AND PASSWORD////////////////////
String url = "CLASS_LINK_HERE phpMyAdmin_SQL";
url += "PERSONAL_PASSWORD_FROM_CLASS";
//MUST UPDATE ABOVE WITH YOUR CLASS LINK AND PASSWORD/////////////////////
conn = DriverManager.getConnection(url);
}
public void deleteMemento() throws SQLException{
System.out.println("Delete Row From Memento");
System.out.print("Enter Memento name: ");
String Name = sc.nextLine();
Statement stmt= conn.createStatement();
String update = "DELETE FROM Memento WHERE Name = '"+Name+"';";
stmt.executeUpdate(update);
System.out.println("Delete Completed.");
System.out.println();
}
public void deleteBuilding() throws SQLException{
System.out.println("Delete Row From Building");
System.out.print("Enter Building name: ");
String Name = sc.nextLine();
Statement stmt= conn.createStatement();
String update = "DELETE FROM Building WHERE Name = '"+Name+"';";
stmt.executeUpdate(update);
System.out.println("Delete Completed.");
System.out.println();
}
public void deleteCivilization() throws SQLException{
System.out.println("Delete Row From Civilization");
System.out.print("Enter Civ name: ");
String Name = sc.nextLine();
Statement stmt= conn.createStatement();
String update = "DELETE FROM Civilization WHERE Name = '"+Name+"';";
stmt.executeUpdate(update);
System.out.println("Delete Completed.");
System.out.println();
}
public void deleteLeader() throws SQLException{
System.out.println("Delete Row From Leader");
System.out.print("Enter Leader name: ");
String Name = sc.nextLine();
Statement stmt= conn.createStatement();
String update = "DELETE FROM Leader WHERE Name = '"+Name+"';";
stmt.executeUpdate(update);
System.out.println("Delete Completed.");
System.out.println();
}
}