Define an HTML Table
A table in HTML consists of table cells inside rows and columns.

HTML Tables allow you to arrange data into rows and columns on a web page, making it easy to display information like schedules, statistics, or other structured data in a clear format. An HTML table is created using the <table> tag.

Basic HTML Table Structure
An HTML table is created using the <table> tag. Inside the table, we use:

<tr>:  Represents a row within the table.
<th>:  Represents the header cells in the table.
<td>:  Represents a regular data cell within the table.
Each <tr> represents a row, and within each row, <th> or <td> tags represent the cells in that row, which can contain text, images, lists, or even another table.

following html code for above table example:-

<!-- table.html -->
<!DOCTYPE html>
<html>

<body>
    <table>
        <tr>
            <th>Firstname</th>
            <th>Lastname</th>
            <th>Age</th>
        </tr>
        <tr>
            <td>Priya</td>
            <td>Sharma</td>
            <td>24</td>
        </tr>
        <tr>
            <td>Arun</td>
            <td>Singh</td>
            <td>32</td>
        </tr>
        <tr>
            <td>Sam</td>
            <td>Watson</td>
            <td>41</td>
        </tr>
    </table>
</body>

</html>

In this Example:

<table>: 
This tag starts the table. Everything between the opening <table> and closing </table> tags makes up the table.
<tr>: 
Stands for “table row”. Each <tr> tag defines a row in the table.
<th>:
 Stands for “table header”. It’s used for the headers of the columns. In this case, “Firstname“, “Lastname“, and “Age” are headers. Text in <th> tags is usually bold and centered by default.
<td>: 
Stands for “table data”. This tag is used for actual data cells under each column. For instance, “Priya” is the data under the “Firstname” header, “Sharma” under the “Lastname“, and “24” under the “Age“.
The first <tr> has three <th> elements, setting up the column titles.
The subsequent <tr> tags contain three <td> elements, representing the data for each person listed in the table.

Another example with  border :-

<!DOCTYPE html>
<html>
<style>
table, th, td {
  border:1px solid black;
}
</style>
<body>

<h2>A basic HTML table</h2>

<table style="width:100%">
  <tr>
    <th>Company</th>
    <th>Contact</th>
    <th>Country</th>
  </tr>
  <tr>
    <td>Alfreds Futterkiste</td>
    <td>Maria Anders</td>
    <td>Germany</td>
  </tr>
  <tr>
    <td>Centro comercial Moctezuma</td>
    <td>Francisco Chang</td>
    <td>Mexico</td>
  </tr>
</table>

<p>To understand the example better, we have added borders to the table.</p>

</body>
</html