$ is relative to the source directory.
All create and drop files are found in the $\data\sql\create\ directory.
create_mysql.sql contains the queries to create the acore user and the databases.
drop_mysql.sql drops the acore user and drops all databases.
All base files are found in the $\data\sql\base\ directory, split per database into the db_auth\, db_characters\ and db_world\ subdirectories.
Each file holds the squashed content of a single table, so the directory as a whole contains all the data up to the latest squash.
Files from this directory are automatically imported with the Automatic Database Updater.
Base files are only regenerated by project maintainers, using the DatabaseSquash.sh script in $\apps\DatabaseSquash. The procedure is documented in database-squash.md inside this directory.
All update files are found in the $\data\sql\updates\ directory, split per database into the db_auth\, db_characters\ and db_world\ subdirectories.
These files contain all the updates committed since the last squash.
Files from this directory are automatically imported with the Automatic Database Updater.
All pending update files are found in the $\data\sql\updates\pending_db_*\ directories, one per database.
All SQL changes you make to fix an issue on AzerothCore go in here.
You create the pending update file by running the create_sql.sh script found in the same directory.
All custom files are found in the $\data\sql\custom\ directory, split per database into the db_auth\, db_characters\ and db_world\ subdirectories.
All custom updates you make to the database should be stored in SQL files within this directory to make sure that they are not lost when updating your server.
These files are re-applied whenever their content changes, so they must be safe to run more than once, for example CREATE TABLE IF NOT EXISTS, REPLACE INTO, DELETE + INSERT, or UPDATE statements with fixed values.
Files from this directory are automatically imported with the Automatic Database Updater.
All archived files are found in the $\data\sql\archive\ directory, split per database into the db_auth\, db_characters\ and db_world\ subdirectories.
This is where update files are moved once the updates directory grows too large. They are not part of the squash procedure and are never applied again, because the updates table shipped in the base files already contains their entries.
All update files before ACDB 10.0.0 are stored here, grouped per database and then per major version (1.x through 9.x). From ACDB 10.0.0 a new method to update Base Files was introduced.