Sample Data and INSERT Statements for a DBMS Lab

A DBMS lab often needs a populated table. Typing fifty INSERT statements by hand is slow, and you do not need to.

Open the SQL Generator

First make the records. Generate the Students dataset (or any dataset you need) in the Mock Data Generator and download it as CSV. Choose a small row count, such as 20 or 50, so the script is easy to read.

Then open the SQL Generator and load the CSV. It guesses a type for each column and lets you edit the column names, types, lengths and keys. Set student_id as the primary key, pick your database (MySQL, PostgreSQL, SQL Server, Oracle or SQLite) and copy the CREATE TABLE and INSERT statements.

Run the script in your lab database. Then practise: SELECT with WHERE, ORDER BY, GROUP BY and HAVING, UPDATE and DELETE, and constraints such as NOT NULL and CHECK (marks BETWEEN 0 AND 100). To practise a JOIN, generate a second table, such as Exam marks, and give both tables a shared key.

Check the generated types before you submit work: dates, lengths and keys should match what your assignment asks for. The data is made up, so it is safe to share and to include in a report.

Everything runs in your browser and nothing is uploaded.

Open the SQL Generator

Related tool pages

  • CSV to SQL Converter: Convert a CSV to SQL: generate CREATE TABLE and INSERT statements for PostgreSQL, MySQL, SQL Server, Oracle or SQLite. Free, in your browser.
  • Excel to SQL Converter: Convert an Excel file to SQL: generate CREATE TABLE and INSERT statements for PostgreSQL, MySQL, SQL Server, Oracle or SQLite. Free, in your browser.
  • JSON to SQL Converter: Convert JSON to SQL: generate CREATE TABLE and INSERT statements for PostgreSQL, MySQL, SQL Server, Oracle or SQLite. Free, in your browser.
  • SQL INSERT Statement Generator: Generate SQL INSERT statements from a CSV, JSON, Excel or Parquet file in seconds, with escaping handled for you. Free, in your browser.

How to use the SQL Generator: step by step

  1. Generate a small dataset and download CSV.
  2. Open the SQL Generator and load the CSV.
  3. Edit the types and set the primary key.
  4. Copy the script and run it in your database.

When to use the SQL Generator

  • Fill a lab database quickly
  • Practise INSERT, UPDATE and DELETE
  • Prepare tables for an assignment
  • Test constraints and keys

Example

Input: id,name,age 1,Ada,36 2,Alan,41

Output: CREATE TABLE people (id INT, name VARCHAR(10), age INT); INSERT INTO people VALUES (1, 'Ada', 36);

Frequently asked questions

Does it connect to my database?

No. It only writes the SQL for you to run yourself.

Which databases does the SQL Generator support?

PostgreSQL, MySQL and MariaDB, SQL Server, Oracle and SQLite. It writes CREATE TABLE and INSERT statements from a CSV, JSON, Excel or Parquet file, and guesses column types from your data.

Tip: Use 20 to 50 rows for a lab. A short script is easier to read, test and explain.