1. What is a Database?

A database is a structured collection of data that is stored and managed in an organized manner. It can store information about various entities like customers, products, orders, etc.

  • Relational Database: A relational database organizes data into tables (relations) consisting of rows (records) and columns (attributes).
2. Key Components of a Database
  • Tables: A table is a collection of data organized in rows and columns. Each table has a unique name, and each column has a specific data type (e.g., INTEGER, VARCHAR, DATE).

  • Rows (Records): Each row represents a single entry or record in a table. It contains a set of values for the columns.

  • Columns (Attributes): A column defines a type of data that will be stored, like customer name, product price, or order date. Columns have names and specific data types.

  • Primary Key: A primary key uniquely identifies each record in a table. It must contain unique values and cannot be null.

  • Foreign Key: A foreign key is a field (or combination of fields) in one table that uniquely identifies a row in another table. It establishes a relationship between two tables.