Uni-Sine
Computer ScienceCourses

Databases: an interactive database and SQL course

Databases is an interactive database course that goes from what a table is to joining tables with SQL and connecting a database to an app. Its 28 short sections cover tables, rows and columns, primary and foreign keys, SELECT queries with WHERE, sorting and limits, INSERT, UPDATE and DELETE, relationships, inner and outer joins, SQL vs NoSQL, schemas, migrations and ORMs.

Nearly every app keeps its data in a database, and SQL is the language most of them speak. Our what is SQL guide covers the language itself in more depth.

What the database course covers

SectionsTopicWhat you do
1 to 3What a database is, and files vs databasesPick the best way to store data for each scenario
4 to 6Tables, rows, columns and primary keysChoose the primary key for each table
7 to 11SELECT, WHERE, ORDER BY and LIMITWrite a SELECT query, then put the clauses of a query in order
12 to 13INSERT, UPDATE and DELETEMatch each SQL command to what it does
14 to 16Relationships and foreign keysRead an entity relationship diagram, then name relationship types
17 to 20INNER, LEFT and RIGHT JOINPick the join for a description, then predict a join's result, NULLs included
21 to 23SQL vs NoSQL and document databasesDecide which suits each scenario
24 to 28Schemas, data types, migrations and ORMsMatch each layer between app and database to its job

Tables and keys

A relational database stores data in tables: each row is one record and each column one piece of information, with a fixed data type. A primary key uniquely identifies each row. A foreign key in one table points at a primary key in another, which is how a database links each order to the customer who placed it.

Writing SQL

The middle of the course is SQL. You read data with SELECT, filter it with WHERE, sort it with ORDER BY and cap it with LIMIT, then change it with INSERT, UPDATE and DELETE, the operations often called CRUD. Joins combine tables: an INNER JOIN keeps only rows that match in both, while a LEFT JOIN keeps every row from the first table and fills gaps with NULL.

SELECT users.name, orders.total
FROM users
INNER JOIN orders ON orders.user_id = users.id
WHERE orders.total > 50
ORDER BY orders.total DESC;

Choosing and managing a database

The last part steps back: when a document database (NoSQL) suits a project better than tables, how schemas and migrations change a database safely over time, and how an ORM such as Prisma lets your code work with the database without writing every query by hand.

Try a question from the course

No two rows can share a primary key value, and the value should never change. In a table of students with columns for name, date of birth, form group and student ID, two students can share a name, a birthday or a form, but no two share a student ID. So the student ID is the primary key.

Now pick the primary key for a new table, then press Mark to check your answer in the course.

Choose the primary key column for each table.

Press Mark to have your answer marked in the Databases course.

Who this course is for

  • Beginners who want to understand how apps store data, and to read and write basic SQL.
  • Computing students revising databases, primary and foreign keys and SQL queries.
  • Web developers starting on the backend, who need relationships, joins and ORMs explained.
  • Analysts and office workers who have outgrown spreadsheets.

What you need to know first

Nothing for the first two thirds: if you have used a spreadsheet, tables will feel familiar. The ORM and migration sections assume you have met a little code, which the HTML, CSS & JavaScript and APIs courses provide.

How long it takes

There are 28 sections and most take a few minutes. Learners without a plan can open two sections of a course a day, in order, so the whole course takes 14 days. A plan removes the daily limit and lets you go straight to any topic, such as joins.

Guided courseAPIsHow apps fetch data from a database through a backend: HTTP, JSON, REST and fetch.

Common questions

Is this database course free?
You can take every section without paying, two sections a day, in order. A plan removes the daily limit and opens any section straight away.
Does this course teach SQL?
Yes. It covers SELECT with WHERE, ORDER BY and LIMIT, INSERT, UPDATE and DELETE, and INNER, LEFT and RIGHT joins, with practice writing and ordering queries.
What is the difference between a primary key and a foreign key?
A primary key uniquely identifies each row in its own table. A foreign key is a column that stores the primary key of a row in another table, linking the two.
What is the difference between an INNER JOIN and a LEFT JOIN?
An INNER JOIN gives back just the rows where both tables have a matching entry. A LEFT JOIN returns every row from the left table, with NULLs where the right table has no match.
Should I learn SQL or NoSQL?
Start with SQL. Relational databases are the most common, and the ideas of keys and relationships carry over. The course then shows when a document database is the better fit.
What is an ORM?
An object-relational mapper: a library that lets your program read and write database rows as ordinary objects in its own language, generating the SQL for you. Prisma is one example.

Revision cards

Say the answer first, then flip the card to check it.

Where to go next

  • Learn it

    Databases

    SQL, NoSQL and everything in between for storing and querying data

    Start the course
  • Test it

    GCSE Computer Science

    A new exam-style paper every day, with instant marking and a mark scheme

    Start today's paper
  • Test it

    A-level Computer Science

    A new exam-style paper every day, with instant marking and a mark scheme

    Start today's paper
Read next
Computer Science · DatabasesWhat is SQL? What it is used for, with simple examplesSQL is the language for asking databases questions. Learn what SQL is, what it is used for, the main commands and how queries work, with examples.