Exportación De Bd Sakika
Enviado por joker222 • 12 de Junio de 2012 • 273 Palabras (2 Páginas) • 533 Visitas
Exportación de bd sakika
1. Descomprimimos la base de datos Sakila en una carpeta llamada “Temp o tmp” ubicada en el disco local C: /.
2. Entrar a “CMD ” y ejecutar lo siguiente cd.. cd..:
3. Entrar a la siguiente ubicación cd xampp/mysql/bin:
4. Después ejecutar el comando mysql -u root –p y dar enter cuando pida el password:
5. Luego ejecutamos SOURCE C:/temp/sakila-schema.sql; para que importe la base de datos.
6. Tambien ejecutamos SOURCE C:/temp/ sakila-data.sql; para exportar los datos a las tablas.
7. Y Por ultimo entremos a la DB Sakila y mostramos las tablas.
Creación de la tabla y particiones
1. Crear la tabla film2 con la misma estructura que film y con las particiones
CREATE TABLE film2 (
film_id INT NOT NULL,
title VARCHAR(255) NOT NULL,
description TEXT DEFAULT NULL,
release_year YEAR DEFAULT NULL,
language_id TINYINT UNSIGNED NOT NULL,
original_language_id TINYINT(3) UNSIGNED DEFAULT NULL,
rental_duration TINYINT UNSIGNED NOT NULL DEFAULT 3,
rental_rate DECIMAL(4,2) NOT NULL DEFAULT 4.99,
length SMALLINT UNSIGNED DEFAULT NULL,
replacement_cost DECIMAL(5,2) NOT NULL DEFAULT 19.99,
rating ENUM('G','PG','PG-13','R','NC-17') DEFAULT 'G',
special_features SET('Trailers','Commentaries','Deleted Scenes','Behind the Scenes') DEFAULT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP)
PARTITION BY RANGE (language_id) (
PARTITION p1 VALUES LESS THAN (1),
PARTITION p2 VALUES LESS THAN (2),
PARTITION p3 VALUES LESS THAN (3),
PARTITION p4 VALUES LESS THAN (4),
PARTITION p5 VALUES LESS THAN MAXVALUE
);
2. Verificar que permitió crear las particiones en mysql consola
3. Insertamos los datos ala tabla film2
4. cambiar campos de la tabla film2 en base a los criterios de:
update film2
set rental_duration=3
where language_id=2
update film2
set rental_duration=4
where language_id=3
...