Koppelingen in nieuw tabblad openen
  1. 9 Best Sample SQL Databases for Practice [+ Free Downloads]

  1. You can create a simple program that uses SQL commands to create a table, insert data, and retrieve it. Below is an example in Python using the sqlite3 module, which works with SQLite databases.

    import sqlite3

    # Connect to database (creates file if it doesn't exist)
    conn = sqlite3.connect("company.db")
    cursor = conn.cursor()

    # 1. Create table (DDL Command)
    cursor.execute("""
    CREATE TABLE IF NOT EXISTS employees (
    id INTEGER PRIMARY KEY,
    first_name TEXT NOT NULL,
    last_name TEXT NOT NULL,
    department TEXT,
    hire_date TEXT
    );
    """)

    # 2. Insert data (DML Command)
    cursor.execute("""
    INSERT INTO employees (first_name, last_name, department, hire_date)
    VALUES ('John', 'Doe', 'IT', '2024-06-01');
    """)

    cursor.execute("""
    INSERT INTO employees (first_name, last_name, department, hire_date)
    VALUES ('Jane', 'Smith', 'HR', '2024-07-15');
    """)

    # Commit changes
    conn.commit()

    # 3. Query data (DQL Command)
    cursor.execute("""
    SELECT first_name, last_name, department
    FROM employees
    WHERE department = 'IT';
    """)

    rows = cursor.fetchall()
    for row in rows:
    print(row)

    # Close connection
    conn.close()
    Gekopieerd.
    Feedback
  2. SQL Examples - W3Schools

    Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.

  3. What Is an SQL Database? A Beginner's Guide

    3 jun. 2025 · An SQL database is any database that uses SQL to query and manage the data it holds. It organizes information into tables, which are made up of rows …

  4. Verkrijg uitgebreide informatie over What's SQL Database Example