Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is for my SQL/Python class 1. Complete the segment of code below to create

ID: 3733858 • Letter: T

Question

This is for my SQL/Python class

1. Complete the segment of code below to create a database called "testdb". It can be assumed that testdb doesn't exists. import MySQLdb con = MySQLdb.connect(user='root')

2.

Write the segment of code to populate the table "users" of the database "testdb" with the data below.

name, address, age

John Doe, 7001 E Williams Field, 32

Assume the following code:

import MySQLdb

con = MySQLdb.connect(db='testdb')

3.  

Complete the code below to retrieve and print in a tabulated format the first 5 records of table "users" of the database "testdb"

import MySQLdb

con = MySQLdb.connect(db='testdb')

4.

What is the output of the code shown below?

re.split('[a-c]', '0a3B6')

Error

['a', 'B']

['0', '3B6']

['a']

A.

Error

B.

['a', 'B']

C.

['0', '3B6']

D.

['a']

Explanation / Answer

Let me know if you have any doubts.

1)

import MySQLdb con = MySQLdb.connect(user='root',db='testdb')

2)

import MySQLdb
con = MySQLdb.connect(db='testdb')
users.create_table()
u = users(name="John Doe", address ='7001 E Williams Field',age=32)
b.save()

3)
import MySQLdb
con = MySQLdb.connect(db='testdb')
cursor = con.cursor()

cursor.execute("SELECT TOP 5 * FROM users")

for (name, address, age) in cursor:
print("{}, {}, {}".format(name, address, age))

4) c. ['0', '3B6']

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote