SQL Tutorial

SQL Introduction SQL Aggregate Functions SQL Aliases SQL And SQL Any All SQL Avg SQL Between SQL Case SQL Comments SQL Count SQL Delete SQL Distinct SQL Exists SQL GROUP BY SQL Having SQL In SQL INSERT INTO SQL Is Not Null SQL Join SQL Full Outer Join SQL Inner Join SQL Left Join SQL Right Join SQL Self Join SQL Like SQL Min Max SQL NOT Operator SQL Null SQL Operators SQL OR operator SQL ORDER BY SQL Select SQL Select Into SQL Top Limit Fetch SQL Stored Procedures SQL Sum SQL Union SQL Update SQL Where SQL Wildcards

SQL Database

SQL Alter Table SQL Auto increment SQL Backup Database SQL Check SQL Constraints SQL Create View SQL Create Database SQL Create Table SQL Data types SQL Dates SQL Default Constraint SQL Drop Database SQL Drop Table SQL Foreign Key SQL Hosting SQL Index SQL injections SQL Not NULL SQL PrimaryKey SQL Unique SQL Views

SQL Backup Database

A database backup is a copy of the data that can be restored after deletion, corruption, deployment mistakes or server failure. The exact command depends on the database system, but the goal is always the same: make recovery possible before something goes wrong.

Important note

Backup syntax is not universal SQL. Each database engine has its own tools and permissions. Treat backup commands as administration tasks, test restores regularly and never assume a backup is useful until a restore has been verified.

Example: SQL Server

BACKUP DATABASE store
TO DISK = 'C:\backups\store.bak';

This creates a backup file for the store database. The database account must have permission to write to the target location.

What a good backup plan includes

Common mistakes

Related topics

Continue with SQL DROP DATABASE, SQL CREATE DATABASE and SQL Injection.