SQL Keyword BACKUP DATABASE
The BACKUP DATABASE keyword is used to create a backup of an existing database, which works only on a Microsoft SQL Server.
- A backup can be a full or differential.
- A differential backup only backs up the parts of the database that have changed since the last full backup.
- The differential backup takes less time compared to the full-back, as it takes backup of only changes.
The below SQL creates a complete database backup and saves it to a backup file.
BACKUP DATABASE test_db
TO DISK = 'D:\backups\test_db.bak';
The below SQL creates a differential database backup and saves it to a backup file.
BACKUP DATABASE test_db
TO DISK = 'D:\backups\test_db.bak'
WITH DIFFERENTIAL;