Create data

  1. Insert a record into the database:

     7cursor.execute(
     8    """INSERT INTO books
     9                  VALUES ('Python basics', 'en', 'Veit Schiele', 'BSD',
    10                          '2021-10-28')"""
    
  2. Save data to database:

    14conn.commit()
    
  3. Insert multiple records using the more secure ? method where the number of ? should correspond to the number of columns:

    17new_books = [
    18    ("Jupyter Tutorial", "en", "Veit Schiele", "BSD-3-Clause", "2019-06-27"),
    19    ("Jupyter Tutorial", "de", "Veit Schiele", "BSD-3-Clause", "2020-10-26"),
    20    ("PyViz Tutorial", "en", "Veit Schiele", "BSD-3-Clause", "2020-04-13"),
    21]
    22cursor.executemany("INSERT INTO books VALUES (?,?,?,?,?)", new_books)
    23conn.commit()