Tables
Tables in in databases work like tables in spreadsheets and arrays in some programming languages. Lets look at database table structure then the similarities and differences from other sorts of tables.
Structure
A database table contains set columns for data and unlimited rows containing those columns as cells. Spreadsheets have the same variable list of rows but have free form columns were a column format is only a suggestion.
The value in a database table cell has to fit exactly into the rules defined for the column. In a spreadsheet, a cell can contain anything, the format is just a default and is mostly for the display.
In a spreadsheet you can enter a variety of words and numbers in a column then format the column as money. The spreadsheet would then attempt to format each cell as a dollar amount. The database equivalent requires the column format definition before any data can go into the column and the database will stop the entry of invalid data. If you really need a flexible format in a database, you have to define the column as something generic, a string, then take the responsibility of formatting the data after you access the column.
There is one database that stores everything as a string but that database has limitations in other areas, making the database unsuitable for storage of the very large lists of data you need in some tables.
Similarities
Database tables have rows and columns. A table usually has indexes with one index being the primary key. A spreadsheet is similar to a table without indexes and no primary key. An array in PHP is similar to a database table with a primary index.
In a database, the table layout and indexes are defined at the start because any changes take a long time. A spreadsheet is always in memory, making changes fast compared to the slow disk access for a database. Your spreadsheet software can work without indexes then create the equivalent to a temporary index when you request something.
In a PHP array, there is an equivalent to a primary index. If you want another index, you create it in your own code. The tables you usually store in a PHP array are small enough to sort when you need the data in a different sequence, giving you the option to access the data in a difference sequence without creating a separate index.
Databases usually contain too much data in a table to sort the whole table. The tables are on disk, making a sort very slow. You create separate indexes for difference sequences, similar to building extra tables in PHP.
Assume you have a list of books. Sometimes you want to browse the books by title. On other occasions, you want to browse by author. A collection of 100 books could be in a spreadsheet. A million books would fit easily into a database but be too big for a spreadsheet.
For something in the middle, say 1000 books, your choice of spreadsheet or database would depend on how many people will access the list at the same time and how far the list might expand in the future.
All three lists, 100, 1000, and 1000000, might have a primary index of ISBN as that is the only unique identifier of books. You create additional indexes for author and title. Given that a title might be used by more than one author, your indexes might be title+author and author+title.
In a database with those extra indexes, you can access the data in one of those sequences. The database will automatically use the index instead of sorting the whole table. You can also define a view in some database and the view will look like a new table in the sequence if the index used for the view. Spreadsheets let you build the equivalent of a view using options including "pivot" tables.
Programming languages do not provide an equivalent to a view or a pivot table. There might be an external library of code you can load to provide an equivalent. Often the quickest way to provide an equivalent is to load an in memory database, like SQLite, then put your data into the database as a table and use the database as a very fast way to access the data in different sequences.
Differences
Database tables have a column layout that is fixed when the table is defined and needs a specific operation to change the layout. A change applies to every row. Some databases have limited options for change, forcing you to make changes in several steps. A change may take a long time to process for a table with many rows and may lock out all other accesses during the table change.
A spreadsheet lets you add extra cells to any row at any time without changing the spreadsheet. You might define a default format for a new column before entering data. You are not forced to do anything and your changes may be in any order. You could add extra cells in a new column then set a default format then add cells of the default format or a different format. After you enter data in a column, you can change the format for the column and the spreadsheet might change the look of the data, depending on the type of data.
When you change an array in memory, everything is instant which removes the problem of locking out data access. In a compiled language like C, a table uses a structure and the type of data in a structure cannot be changed without recompiling the code. A structure can contain addresses of data instead of actual data, giving you the option to change the type of data stored at the addresses.
You can add indexes to tables at any time and can remove indexes from tables when they are no longer used for access. If you want to change an index named A, you could create a different index named B, change all your code to use B, then delete A. You could do this on a running system after all the new code is in use.
Your use
Tables in databases used to be purely for long term storage due to the need for precise structure and usage. Today there are so many easy options, including temporary in memory storage, that you can look at using database tables as alternatives to program based arrays and a spreadsheet approach. You will have to look at many brands of databases, and several storage engines in some brands, to find the best fit for each usage. Enjoy the flexibility.