Free · beginner-friendly · non-commercial

Learn How Apps Talk to Databases

DatabaseIntegrate.org is a free starting point for students and new developers: a short learning path, a visual SQL query builder and a connection string generator with code examples in six languages. No sign-up, nothing to buy.

Start the learning path Open the SQL query builder

A five-step learning path

Work through these in order. Each step takes an evening or two.

1. Tables, rows and keys

A relational database stores data in tables. Each row is one record and each column one attribute. A primary key uniquely identifies a row; a foreign key points to a row in another table, which is how an order “belongs to” a customer. Sketch your app's data on paper as tables before writing any code.

2. The four basic statements

SELECT reads rows, INSERT adds them, UPDATE changes them and DELETE removes them. WHERE limits which rows are affected – forgetting it on an UPDATE or DELETE changes every row. Practise with the visual query builder and read the SQL it generates.

3. Connecting from code

Your program reaches the database through a driver and a connection string containing host, port, database name and credentials. Keep the password out of your source code by reading it from an environment variable. The connection string generator shows the format for eight engines with Python, Node.js, Java, C#, PHP and Go examples.

4. Parameters, not string concatenation

Never build SQL by gluing user input into a string – that is how SQL injection happens. Use parameterised queries (placeholders such as ? or $1) so the driver sends values separately from the SQL. Every mainstream driver supports this.

5. When it gets slow

Most slowness comes from missing indexes, fetching more rows or columns than needed, or running one query per item in a loop. Learn to read a query plan with EXPLAIN, then work through ten performance strategies.

Get new lessons by email

An occasional email when a new lesson or tool is added.

Loading latest news...