<jupyter_start><jupyter_text>1. How do we model a many-to-many relationship between two database tables?  Ans: We add a table with two foreign keys  2. In Python, what is a database "cursor" most like?  Ans: A file handle  3. What method do you call in an SQLIte cursor object in Python to run an SQL command?  Ans: execute()  4. In the following SQL,<jupyter_code>cur.execute('SELECT count FROM Counts WHERE org = ? ', (org, ))<jupyter_output><empty_output><jupyter_text>Ans: It is a placeholder for the contents of the "org" variable  5. In the following Python code sequence (assuming cur is a SQLite cursor object),<jupyter_code>cur.execute('SELECT count FROM Counts WHERE org = ? ', (org, ))
row = cur.fetchone()<jupyter_output><empty_output><jupyter_text>Ans: None  6. What does the LIMIT clause in the following SQL accomplish?<jupyter_code>SELECT org, count FROM Counts 
   ORDER BY count DESC LIMIT 10<jupyter_output><empty_output><jupyter_text>Ans: It only retrieves the first 10 rows from the table  7. What does the executescript() method in the Python SQLite cursor object do that the normal execute() method does not do?  Ans: It allows multiple SQL statements separated by semicolons  8. What is the purpose of "OR IGNORE" in the following SQL:<jupyter_code>INSERT OR IGNORE INTO Course (title) VALUES ( ? )<jupyter_output><empty_output><jupyter_text>Ans: It makes sure that if a particular title is already in the table, there are no duplicate rows inserted  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:<jupyter_code>cur.execute('''INSERT OR IGNORE INTO Course (title)
    VALUES ( ? )''', ( title, ) )
cur.execute('SELECT id FROM Course WHERE title = ? ', 
    (title, ))
course_id = cur.fetchone()[0]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08387799564270153, 'fraction_numerical': 0.007625272331154684, 'mean_word_length': 5.042763157894737, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '431886', 'license': 'MIT', 'n_tokens_mistral': 566, 'n_tokens_neox': 547, 'n_words': 241, 'path': 'Coursera/Using Databases with Python/Week-4/Quiz/Many-to-Many-Relationships-and-Python.ipynb', 'repo_name': 'manipiradi/Online-Courses-Learning', 'size': '1836'}