SHARE
TWEET

Untitled

a guest Jul 20th, 2019 119 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def lastyearsrevenue():
  2.     sum2015 = 0.0
  3.     mySQLconnection = mysql.connector.connect(host='sql9.freesqldatabase.com',database='sql9298674',user='sql9298674',password='KR5i4m6mya')
  4.        
  5.     sql_select_data = "select * from EMC_data" #to fetch all rows from the database
  6.     data_cursor = mySQLconnection.cursor()  #Creating a cursor to point to all entries in the database
  7.     data_cursor.execute(sql_select_data)   #returns a ResultSet object which contains all the rows
  8.     data_records = data_cursor.fetchall()
  9.        
  10.     for row in range(data_cursor.rowcount):
  11.         if "2015" in data_records[row][1]:
  12.             if data_records[row][2].isdigit() and data_records[row][3].replace('$','').isdigit():
  13.                 #sum2015 += int(data_records[row][2])*float(data_records[row][3].replace('$',''))
  14.         else:
  15.             continue
  16.     #print("The annual revenue for 2015 was: ",sum2015)
  17.  
  18. connect_SQL_EMC_database()
  19.  
  20. lastyearsrevenue()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top