Cursos /
SQL in Python Projects
Reto 1: Primera tabla
Completa todas las partes de la tarea en secuencia
- 📁 Crear un nuevo proyecto en PyCharm.
- 📝 Crea un nuevo archivo python.
- 📚 Importar la librería
sqlite3
. - 🗄 Crear una nueva base de datos
- 🤚 Crear un `cursor
- 📄 Crea una tabla llamada
articles
con los siguientes campos: ``sql id INTEGER título TEXTO contenido TEXTO autor TEXTO
1. It is recommended to do ...
2. Some text
3. Use such method.
2. Some text
It is how code looks like
text again3. Use such method.
# Import the sqlite3 library
import sqlite3
# Create a new database (or connect to an existing one)
connection = sqlite3.connect("my_database.db")
# Create a cursor
cursor = connection.cursor()
# Create a table named "articles" with the specified fields
cursor.execute('''
CREATE TABLE articles (
id INTEGER,
title TEXT,
content TEXT,
author TEXT
)
''')
# Save the changes and close the database connection
connection.commit()
connection.close()
¿Todo estuvo claro?
Sección 2. Capítulo 5
Contenido del Curso
SQL in Python Projects
1. Entorno de desarrollo en tu PC
4. Más sobre SQLite
SQL in Python Projects
Reto 1: Primera tabla
Completa todas las partes de la tarea en secuencia
- 📁 Crear un nuevo proyecto en PyCharm.
- 📝 Crea un nuevo archivo python.
- 📚 Importar la librería
sqlite3
. - 🗄 Crear una nueva base de datos
- 🤚 Crear un `cursor
- 📄 Crea una tabla llamada
articles
con los siguientes campos: ``sql id INTEGER título TEXTO contenido TEXTO autor TEXTO
1. It is recommended to do ...
2. Some text
3. Use such method.
2. Some text
It is how code looks like
text again3. Use such method.
# Import the sqlite3 library
import sqlite3
# Create a new database (or connect to an existing one)
connection = sqlite3.connect("my_database.db")
# Create a cursor
cursor = connection.cursor()
# Create a table named "articles" with the specified fields
cursor.execute('''
CREATE TABLE articles (
id INTEGER,
title TEXT,
content TEXT,
author TEXT
)
''')
# Save the changes and close the database connection
connection.commit()
connection.close()
¿Todo estuvo claro?
Sección 2. Capítulo 5