Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: First Table | Introduction to SQLite
Databases in Python
course content

Kursusindhold

Databases in Python

Databases in Python

1. Introduction to SQLite
2. CRUD
3. More About SQLite
4. SQLAlchemy

book
Challenge: First Table

Opgave

Swipe to start coding

Your task is to complete the code that creates an SQLite database and a table called articles. Here’s what you need to do:

  1. Connect to the database my_database.db.
  2. Create a cursor to execute SQL commands.
  3. Use the cursor to create a table named articles with the following fields:
    • id — type INTEGER.
    • title — type TEXT.
    • content — type TEXT.
    • author — type TEXT.
  4. Save the changes and close the database connection.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 5
toggle bottom row

book
Challenge: First Table

Opgave

Swipe to start coding

Your task is to complete the code that creates an SQLite database and a table called articles. Here’s what you need to do:

  1. Connect to the database my_database.db.
  2. Create a cursor to execute SQL commands.
  3. Use the cursor to create a table named articles with the following fields:
    • id — type INTEGER.
    • title — type TEXT.
    • content — type TEXT.
    • author — type TEXT.
  4. Save the changes and close the database connection.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 5
Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Vi beklager, at noget gik galt. Hvad skete der?
some-alt