Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a function with the following signature: def createTableSQL(table_name,fields): Where table_name is a string and fields is a list of strings. It should return a

Create a function with the following signature:

def createTableSQL(table_name,fields):

Where table_name is a string and fields is a list of strings. It should return a SQL string which is the CREATE TABLE SQL required to create the table in a SQL DB. You should use the following general pattern:

CREATE TABLE IF NOT EXISTS `{table_name}` ( `{field1}` varchar(255) NOT NULL, `{field2}` varchar(255) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Your function should be called like this in the Python script you submit:

print(createTableSQL('test_users',['id','name','email','phone','password']))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

More Books

Students also viewed these Databases questions

Question

Repeat Problem 3.19 for the case of 2-methylbutane.

Answered: 1 week ago

Question

55ggt

Answered: 1 week ago