Jump to content

Database dump

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Brahmmesh (talk | contribs) at 04:16, 30 November 2016 (I tested in pgadmin auto increment is not working as expected If i use 'serial' it takes care of auto increment). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
For information on obtaining the Wikipedia database, see Wikipedia:Database download.

A database dump contains a record of the table structure and/or the data from a database and is usually in the form of a list of SQL statements. A database dump is most often used for backing up a database so that its contents can be restored in the event of data loss. Corrupted databases can often be recovered by analysis of the dump. Database dumps are often published by free software and free content projects, to allow reuse or forking of the database.

Example

-- Database
CREATE DATABASE `example`;
USE `example`;

-- Table structure for table `users`
CREATE TABLE `users` (
  `id` serial NOT NULL,
  `username` varchar(16) NOT NULL,
  `password` varchar(16) NOT NULL,
  PRIMARY KEY (`id`)
);

-- Data for table `users`
INSERT INTO `users` VALUES (1,'alice','secret'),(2,'bob','secret');

See also