Database dump: Difference between revisions

Content deleted Content added
Importing Wikidata short description: "Record of the table structure and/or the data from a database"
 
(18 intermediate revisions by 13 users not shown)
Line 1:
{{Short description|Record of the table structure and/or the data from a database}}
{{technical|date=June 2016}}
{{UnreferencedNo footnotes|date=MarchOctober 20072022}}
{{for|information on obtaining a database dump of the Wikipedia contents|Wikipedia:Database dump|selfref=yes}}
A '''database dump''' (also: '''SQL dump''') contains a record of the [[Table (database)|table]] structure and/or the data from a [[database]] and is usually in the form of a list of [[SQL]] statements ("SQL dump"). A database dump is most often used for [[backup|backing up]] a database so that its contents can be restored in the event of [[data loss]]. [[Data corruption|Corrupted]] databases can often be recovered by analysis of the dump. Database dumps are often published by [[free software]] and [[free content]] projects, to allowfacilitate reuse or, [[Fork (software development)|forking]], ofoffline theuse, databaseand long-term [[digital preservation]].
 
Dumps can be [[data portability|transported]] into environments with [[Internet blackout]]s or otherwise restricted Internet access, as well as facilitate local searching of the database using sophisticated tools such as <code>[[grep]]</code>.
== Example ==
<source lang="sql">
-- Database
CREATE DATABASE `example`;
USE `example`;
 
-- Table structure for table `users`
CREATE TABLE `users` (
`id` int(8) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(16) NOT NULL,
`password` varchar(16) NOT NULL,
PRIMARY KEY (`id`)
);
-- For auto increment when the new record added to the table --
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');
</source>
 
== See also ==
*[[Import and export of data]]
*[[Core dump]]
*[[Databases]]
*[[Database management system]]
*[[SQLyog]]- MySQL GUI tool to generate Database dump
* [[Data portability]]
 
== External links ==
Line 39 ⟶ 18:
*[http://www.postgresql.org/docs/8.2/interactive/backup-dump.html PostgreSQL dump backup methods], for [[PostgreSQL]] databases.
 
[[Category:Databases| *]]
[[Category:Database theory]]