日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > python >内容正文

python

Coursera课程Python for everyone:Quiz: Many-to-Many Relationships and Python

發(fā)布時(shí)間:2025/3/21 python 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Coursera课程Python for everyone:Quiz: Many-to-Many Relationships and Python 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Many-to-Many Relationships and Python

9?試題

1.?

How do we model a many-to-many relationship between two database tables?

We add a table with two foreign keys

We add 10 foreign keys to each table with names like artict_id_1, artist_id2, etc.

We use the ARRAY column type in both of the tables

We use a BLOB column in both tables

2.?

In Python, what is a database "cursor" most like?

A function

A Python dictionary

A method within a class

A file handle

3.?

What method do you call in an SQLIte cursor object in Python to run an SQL command?

run()

socket()

send()

execute()

4.?

In the following SQL,

cur.execute('SELECT count FROM Counts WHERE org = ? ', (org, ))

what is the purpose of the "?"?

It is a syntax error

It is a placeholder for the contents of the "org" variable

It allows more than one boolean operation in the WHERE clause

It is a search wildcard

5.?

In the following Python code sequence (assuming cur is a SQLite cursor object),

cur.execute('SELECT count FROM Counts WHERE org = ? ', (org, )) row = cur.fetchone()

what is the value in row if no rows match the WHERE clause?

An empty list

-1

None

An empty dictionary

6.?

What does the LIMIT clause in the following SQL accomplish?

SELECT org, count FROM Counts ORDER BY count DESC LIMIT 10

It only retrieves the first 10 rows from the table

It only sorts on the first 10 characters of the column

It reverses the sort order if there are more than 10 rows

It avoids reading data from any table other than Counts

7.?

What does the executescript() method in the Python SQLite cursor object do that the normal execute() method does not do?

It allows embedded JavaScript to be executed

It allows multiple SQL statements separated by semicolons

It allows database tables to be created

It allows embeded Python to be executed

8.?

What is the purpose of "OR IGNORE" in the following SQL:

INSERT OR IGNORE INTO Course (title) VALUES ( ? )

It makes sure that if a particular title is already in the table, there are no duplicate rows inserted

It ignores errors in the SQL syntax for the statement

It updates the created_at value if the title already exists in the table

It ignores any foreign key constraint errors

9.?

For the following Python code to work, what must be added to the title column in the CREATE TABLE statement for the Course table:

cur.execute('''INSERT OR IGNORE INTO Course (title)VALUES ( ? )''', ( title, ) ) cur.execute('SELECT id FROM Course WHERE title = ? ', (title, )) course_id = cur.fetchone()[0]

A UNIQUE constraint

A NOT NULL constraint

A PRIMARY KEY indication

An AUTOINCREMENT indication

《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀

總結(jié)

以上是生活随笔為你收集整理的Coursera课程Python for everyone:Quiz: Many-to-Many Relationships and Python的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。