What is the difference between a database, a table, a row and a column?

BeginnerConceptMySQL
Answer

Short answer

A database is a named container (like shop). Inside it are tables (like orders), each storing one kind of thing. A column is one attribute with a type (like total DECIMAL). A row is one record (one specific order).

Example

CREATE DATABASE shop;          -- the container
USE shop;
CREATE TABLE orders (          -- a table
  id INT PRIMARY KEY,          -- columns ↓
  customer VARCHAR(100),
  total DECIMAL(10,2)
);
INSERT INTO orders VALUES (1, 'Asha', 52000.00);   -- one row

In MySQL, "schema" = "database"

CREATE SCHEMA shop and CREATE DATABASE shop are the same thing in MySQL. (In PostgreSQL a schema is a folder inside a database.)

What to say in the interview

"Database is the container, a table holds one entity type, columns are typed attributes and rows are individual records. In MySQL, schema and database are synonyms."

All Databases (MySQL, PostgreSQL, MongoDB) questions Roadmap: MySQL basics

More on MySQL