SQL

Database Table

Database tables are the primary storage objects within a relational database, where data is organized into a structured format consisting of rows and columns. Each table represents a specific type of data and can be related to other tables through foreign keys. Here’s a more detailed explanation of database tables:

Structure of a Database Table

  1. Columns (Fields/Attributes):
    • Definition: Columns define the data type and constraints for a specific piece of data stored in the table.
    • Attributes: Each column has a name, data type (e.g., INTEGER, VARCHAR, DATE), and optional constraints (e.g., PRIMARY KEY, NOT NULL).
  2. Rows (Records/Tuples):
    • Definition: Rows represent individual entries or records in the table.
    • Attributes: Each row contains data for each column defined in the table.

Example of a Database Table

EmployeeID FirstName LastName DepartmentID Salary HireDate
1 John Doe 1 60000.00 2021-01-11
2 Jane Smith 2 65000.00 2019-03-21
3 Emily Smith 3 62000.00 2020-11-27