An SQL Server database contains primary data files, secondary data files (optional), and transaction log files.
The primary and secondary datafiles contain tables, database objects, schema, and data.
The file extension of the primary database file is *.mdf, and the file extension of the secondary data file is *.ndf.
The transaction log files store all the changes made by the transactions (insert, update, and delete). If the SQL Server restarts unexpectedly or crashes, the database engine rolls the incomplete transaction back before the point of failure using the Transaction log file.
The extension of the transaction log file is *.ldf. You might want to refer to this article to understand the Transaction Log Files architecture.
In this article, I am going to explain how we can manage the database files (MDF files) in SQL Server 2019.