Skip to content

Commit 5bd4be8

Browse files
Add files via upload
1 parent 75cfe7c commit 5bd4be8

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

yogamats_sold.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import sys
2+
import cx_Oracle
3+
import os
4+
5+
6+
7+
8+
if os.path.exists("yogamatssold"):
9+
os.remove("yogamatssold")
10+
print("File removed.")
11+
else:
12+
print("No yogamatssold file here")
13+
14+
15+
cx_Oracle.init_oracle_client(lib_dir="/usr/lib/oracle/21/client64/lib")
16+
17+
con = cx_Oracle.connect(user="curious", password="access*SOL", dsn="adw-xyz")
18+
19+
20+
sys.stdout = open('yogamatssold', 'w')
21+
22+
cur = con.cursor()
23+
24+
25+
sql0 = "select count(*) from jun2021vaersdata where state = 'MD' and age_yrs BETWEEN 30 and 50"
26+
27+
cur.execute(sql0)
28+
count = cur.fetchone()
29+
30+
print(count, "Total mats sold in MD")
31+
32+
sql1 = "select count(*) from jun2021vaersdata where state = 'MD' and age_yrs BETWEEN 30 and 50 and sex = 'F'"
33+
34+
cur.execute(sql1)
35+
count1 = cur.fetchone()
36+
37+
print(count1, "Total mats sold to women between ages 30 and 50")
38+
39+
sql2 = "select count(*) from jun2021vaersdata where state = 'MD' and age_yrs BETWEEN 30 and 50 and sex = 'M'"
40+
41+
cur.execute(sql2)
42+
count2 = cur.fetchone()
43+
print(count2, "Total mats sold to men between ages 30 and 50")
44+
45+
46+
sys.stdout.close

0 commit comments

Comments
 (0)