-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprojection.py
More file actions
37 lines (29 loc) · 931 Bytes
/
projection.py
File metadata and controls
37 lines (29 loc) · 931 Bytes
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
# Get the names of all donors with greater than x donations
# Get the vehicle type from logistics depending on the distance in an order
import pretty
from pretty import *
def donorGrtrX(cur, con):
try:
x = int(input("Enter x: "))
query = "SELECT * FROM DONOR WHERE Number_of_donations > '%d' " %(x)
if cur.execute(query):
pretty(cur.fetchall())
con.commit()
except Exception as e:
con.rollback()
print("Failed to perform projection")
print(">>>>>>>>>>>>>", e)
return
def getVehicle(cur, con):
try:
distmin = int(input("Enter lower limit distance: "))
distmax = int(input("Enter upper limit distance: "))
query = "SELECT Vehicle_type FROM LOGISTICS WHERE distance >= '%d' AND distance <= '%d'" %(distmin, distmax)
if cur.execute(query):
pretty(cur.fetchall())
con.commit()
except Exception as e:
con.rollback()
print("Failed to perform projection")
print(">>>>>>>>>>>>>", e)
return