Oracle Magazine, May/June 2018
Database Developer OPEN SOURCE ORACLE MAGAZINE MAY JUNE 2018 83 statement select id name age notes from cx_ people cur execute statement res cur fetchall print res When I run select py in my Python session I see 1 Bob 35 I like dogs 2 Kim 27 I like birds Heres what the code does 1 Gets a cursor object from your connection You will use this cursor to perform your database operations 2 Prepares a SQL SELECT statement specifying the columns wanted from the table 3 Executes the statement 4 Fetches the results into a variable 5 Prints the results DEEPER DIVE Now modify the SELECT statement to order the results by age When youre done the results should be 2 Kim 27 I like birds 1 Bob 35 I like dogs What does the successful code look like Heres the answer
You must have JavaScript enabled to view digital editions.