What is the difference between a database and a table?
Answer
A database is a container that organizes and stores a collection of related data. It can hold multiple tables, views, stored procedures, indexes, and other database objects. A database represents an entire application's data (e.g., an e-commerce database containing everything for the store). A table is a specific structure within a database that organizes data about a single entity or concept into rows and columns. For example, an e-commerce database might contain tables named users, products, orders, and order_items. Each table has a defined schema — the column names and their data types. Each row in a table is one record (one user, one product). Each column represents one attribute (user's email, product's price). Relationship: one database contains many tables; one table contains many rows and a fixed set of columns. In MySQL: CREATE DATABASE shop;, USE shop;, CREATE TABLE users (...);.