1.Question 1Which of the following commands will install the jupyter package onto your Python environment?1 pointinstall pip jupyterpip install jupyterpip upgrade jupyterPython install jupyter2.Question 2When connecting a Python front end to a SQL back end database, you use an API (also known as a driver). What is the most commonly used API that will allow you to connect your Python program to your database? 1 pointDatabase/Python ConnectorMySQL API ConnectorSQL ConnectionsMySQL/Python Connector 3.Question 3How can you communicate with a MySQL database after establishing a connection?1 pointCreate a connection objectCreate a Python string of your SQL queryCreate a cursor object.Create a MySQL database4.Question 4The Python cursordict subclass allows you to return each row as a dictionary and in turn assists with accessing variables from the data. What is a disadvantage of using this subclass?1 pointThe data returned must be stored locally in your computer.You will use more processing power for the data.There will be a high number of queries in order to process the data.Converting the data into a dictionary will require more code.5.Question 5Which of the following commands use the correct syntax to create a Python string object across multiple lines?1 point1mysql_query = SELECT * FROM Orders;12345mysql_query = """SELECT *FROM Orders """ 1234mysql_query = SELECT *FROM Orders; 12345mysql_query = "SELECT *FROM Orders " 6.Question 6You have executed a query on the database that’s returning five records.You then want to use the results from the first query in a subsequent second query. What’s the best approach to follow?1 pointCreate a standard cursor and call the fetchmany with size=1 to use the id in your second query. Create a standard cursor call and interleave the results in a second query.Create a buffered cursor and after all the results are returned, use that data in a second subsequent query. Create a dictionary cursor and call the fetchall module to use that data in your second query.7.Question 7Which of the following is the correct syntax to establish a connection between Python and MySQL databases with a connector aliased as conn?1 pointconnector(username=”user1”, password=”pass1”)connection = (username=”user1”, password=”pass1”)conn.connect(username=”user1”, password=”pass1”)conn.connection((username=”user1”, password=”pass1”)8.Question 8You are creating a new database table in your MySQL database using Python. How do you define the table structure and column types?1 pointDefine the table structure in Python. The column types are automatically selected by the MySQL database.Define both the table structure and the column types in your SQL CREATE TABLE statement.Define the table structure in your SQL CREATE TABLE statement. Define the column types in Python.Define the table structure and the column types in Python. Create a table using the SQL CREATE TABLE statement.9.Question 9Below is a query to create a new table to track data on customer orders at a restaurant. What is the correct order of operation to successfully use this query in a cursor object in the database?12345678create_table_customers = """CREATE TABLE customers(CustomerId INT AUTO_INCREMENT,Name VARCHAR(200),Age INT,OrderAmount INT""")1 pointcursor.commit(create_table_customers)cursor.commit(create_table_customers)cursor.execute()cursor.execute(create_table_customers)cursor.commit()cursor.execute(create_table_customers)10.Question 10What keyword or module must be added to your syntax to execute the query to create a new database?cursor = connection.____()cursor.execute("CREATE DATABASE database_name")1 pointconnectorconnectioninsertcursor
Question
1.Question 1Which of the following commands will install the jupyter package onto your Python environment?1 pointinstall pip jupyterpip install jupyterpip upgrade jupyterPython install jupyter2.Question 2When connecting a Python front end to a SQL back end database, you use an API (also known as a driver). What is the most commonly used API that will allow you to connect your Python program to your database? 1 pointDatabase/Python ConnectorMySQL API ConnectorSQL ConnectionsMySQL/Python Connector 3.Question 3How can you communicate with a MySQL database after establishing a connection?1 pointCreate a connection objectCreate a Python string of your SQL queryCreate a cursor object.Create a MySQL database4.Question 4The Python cursordict subclass allows you to return each row as a dictionary and in turn assists with accessing variables from the data. What is a disadvantage of using this subclass?1 pointThe data returned must be stored locally in your computer.You will use more processing power for the data.There will be a high number of queries in order to process the data.Converting the data into a dictionary will require more code.5.Question 5Which of the following commands use the correct syntax to create a Python string object across multiple lines?1 point1mysql_query = SELECT * FROM Orders;12345mysql_query = """SELECT *FROM Orders """ 1234mysql_query = SELECT *FROM Orders; 12345mysql_query = "SELECT *FROM Orders " 6.Question 6You have executed a query on the database that’s returning five records.You then want to use the results from the first query in a subsequent second query. What’s the best approach to follow?1 pointCreate a standard cursor and call the fetchmany with size=1 to use the id in your second query. Create a standard cursor call and interleave the results in a second query.Create a buffered cursor and after all the results are returned, use that data in a second subsequent query. Create a dictionary cursor and call the fetchall module to use that data in your second query.7.Question 7Which of the following is the correct syntax to establish a connection between Python and MySQL databases with a connector aliased as conn?1 pointconnector(username=”user1”, password=”pass1”)connection = (username=”user1”, password=”pass1”)conn.connect(username=”user1”, password=”pass1”)conn.connection((username=”user1”, password=”pass1”)8.Question 8You are creating a new database table in your MySQL database using Python. How do you define the table structure and column types?1 pointDefine the table structure in Python. The column types are automatically selected by the MySQL database.Define both the table structure and the column types in your SQL CREATE TABLE statement.Define the table structure in your SQL CREATE TABLE statement. Define the column types in Python.Define the table structure and the column types in Python. Create a table using the SQL CREATE TABLE statement.9.Question 9Below is a query to create a new table to track data on customer orders at a restaurant. What is the correct order of operation to successfully use this query in a cursor object in the database?12345678create_table_customers = """CREATE TABLE customers(CustomerId INT AUTO_INCREMENT,Name VARCHAR(200),Age INT,OrderAmount INT""")1 pointcursor.commit(create_table_customers)cursor.commit(create_table_customers)cursor.execute()cursor.execute(create_table_customers)cursor.commit()cursor.execute(create_table_customers)10.Question 10What keyword or module must be added to your syntax to execute the query to create a new database?cursor = connection.____()cursor.execute("CREATE DATABASE database_name")1 pointconnectorconnectioninsertcursor
Solution
-
The correct command to install the jupyter package onto your Python environment is "pip install jupyter".
-
The most commonly used API that will allow you to connect your Python program to your database is the MySQL/Python Connector.
-
After establishing a connection with a MySQL database, you can communicate with it by creating a cursor object.
-
A disadvantage of using the Python cursordict subclass is that you will use more processing power for the data.
-
The correct syntax to create a Python string object across multiple lines is: mysql_query = """SELECT * FROM Orders """
-
The best approach to use the results from the first query in a subsequent second query is to create a buffered cursor and after all the results are returned, use that data in a second subsequent query.
-
The correct syntax to establish a connection between Python and MySQL databases with a connector aliased as conn is: conn.connect(username=”user1”, password=”pass1”)
-
When creating a new database table in your MySQL database using Python, you define both the table structure and the column types in your SQL CREATE TABLE statement.
-
The correct order of operation to successfully use this query in a cursor object in the database is: cursor.execute(create_table_customers) cursor.commit()
-
The keyword or module that must be added to your syntax to execute the query to create a new database is "cursor". The correct syntax is: cursor = connection.cursor() cursor.execute("CREATE DATABASE database_name")
Similar Questions
1.Question 1What is the command you will use to verify the installed packages on your Python environment?1 pointlist packagespip list allshow packagespip list2.Question 2When connecting a Python front end to a SQL back end database, you use an API (also known as a driver). What is the most commonly used API that will allow you to connect your Python program to your database? 1 pointMySQL API ConnectorSQL ConnectionsMySQL/Python Connector Database/Python Connector3.Question 3How can you communicate with a MySQL database after establishing a connection?1 pointCreate a MySQL databaseCreate a cursor object.Create a connection objectCreate a Python string of your SQL query4.Question 4In the MySQL/Python connector, what type of cursor object will allow you to return the results of a SQL query without preprocessing the data into Python friendly interpretations?1 pointcursordictionary subclasscursorprimary subclasscursorraw subclasscursorprocess subclass5.Question 5Which of the following commands use the correct syntax to create a Python string object across multiple lines?1 point12345mysql_query = "SELECT *FROM Orders " 12345mysql_query = """SELECT *FROM Orders """ 1mysql_query = SELECT * FROM Orders;1234mysql_query = SELECT *FROM Orders; 6.Question 6You have executed a query on the database that’s returning five records. However, you only want to retrieve the first record from the database. What’s the best approach to follow?1 pointCreate a standard cursor and invoke the fetchone module after executing your SQL query. Create a dictionary cursor and call the fetchall module after executing your SQL query.Create a standard cursor and call the fetchmany with size=1 after executing your SQL query. Create a buffered cursor and call the fetchone module after executing your SQL query.7.Question 7You’re establishing a connection between MySQL databases using Python and need to pass your parameters. Which of the following parameters are required? Select all that apply.1 pointThe MySQL server address (the host)The correct MySQL passwordThe authenticated MySQL usernameThe MySQL database name8.Question 8Which of the following is the correct query to create a new database using Python code?1 pointcursor.execute(CREATE DATABASE sample_database)connection.execute(create, “sample_database”)database.create(“sample_database”)create_database_query = “CREATE DATABASE sample_database”9.Question 9When using Python to create a table, you must invoke the commit module on the connection after executing the CREATE TABLE statement. 1 pointTrueFalse10.Question 10What keyword or module must be added to your syntax to execute the query to create a new database?cursor = connection.____()cursor.execute("CREATE DATABASE database_name")1 pointconnectorconnectioninsertcursor
Question 1Which of the following statements establishes the connection between a Jupyter Notebook SQL extension and an SQLite database ‘EMP.db’?1 point%sql sqlite:///EMP.db%sql sqlite:///EMP.db %sql sqlite:/EMP.db%sql sqlite3://EMP.db2.Question 2Which two of the follow
What is JupyterLab? Group of answer choices An open-source web application specialised in data analytics using Python. An official application of Python for registered users. A special program developed for Python programming in astronomic research. The name of the Python laboratory in Silicon Valley.
Python and MySQL Database: A Practical IntroductionReal Pythonhttps://realpython.com › python-mysqlMySQL is available for all major operating systems, including Windows, macO
Which of the following statement(s) about Python is NOT correct (i.e. False)?1 point The Python ecosystem is very rich and provides easy to use tools for data science. Due to its proprietary nature, database access from Python is not available for many databases.There are libraries and APIs available to access many of the popular databases from Python. Python is a popular scripting language for connecting and accessing databases.
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.