Desarrolla el diseño fisico de la base de datos partiendo del esquema logico.
A) Instalación y Configuración del Sistema Gestor de Base de Datos
-Instalacion
-Entorno de Tabajo
B) Elaboracion del Diseño Físico y su implementación en el sistema gestor
-Creación de base de batos
-Creación de tablas
-Eliminación de tablas
-Modificación de tablas
-Relaciones
C) Uso de herramientas CASE para el desarrollo de Base de Datos
Indicadores Porcentaje
*Desarrollo y diseño físico-----------------------50%
*Uso de herramientas CASE---------------------30%
*Presentación de Resultado---------------------10%
*Actitudes -------------------------------------------10%
EXAMEN
EXAMEN
Ejercicio 1
mysql>
create database Materia_prima;
Query OK, 1 row affected (0.02 sec)
mysql>
use Materia_prima;
Database
changed
mysql>
create table Productos(codigo varchar(3),nombre varchar(10),precio varcha
r(8),fecha_de_compra
varchar(12));
Query OK, 0 rows affected (0.09 sec)
mysql> insert into Productos
values('a01','vinos','250','2009/11/02');
Query OK, 1 row affected (0.01 sec)
mysql> insert into Productos values('a02','silla_modelo.zaz','200','2009/11/03');
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> insert into Productos values('a03','silla_modelo.xax','400','2009/11/03');
Query OK, 1 row affected, 1 warning (0.01 sec)
mysql> insert into Productos
values('a04','florero.Chan','300','2009/11/03');
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> insert into Productos values('a05','mesa_modelo.htp','100','2009/11/05');
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql>
select* from productos;
+--------+------------+--------+-----------------+
| codigo
| nombre | precio | fecha_de_compra |
+--------+------------+--------+-----------------+
|
a01 | vinos | 250
| 2009/11/02 |
|
a02 | silla_mode | 200 | 2009/11/03 |
|
a03 | silla_mode | 400 | 2009/11/03 |
|
a04 | florero.Ch | 300 | 2009/11/03 |
| a05 |
mesa_model | 100 | 2009/11/05 |
+--------+------------+--------+-----------------+
5 rows in set (0.00 sec)
mysql> select* from productos where nombre='vinos';
+--------+--------+--------+-----------------+
| codigo
| nombre | precio | fecha_de_compra |
+--------+--------+--------+-----------------+
| a01 |
vinos | 250 | 2009/11/02 |
+--------+--------+--------+-----------------+
1 row in set (0.00 sec)
mysql> select* from productos where nombre like
'S%';
+--------+------------+--------+-----------------+
| codigo
| nombre | precio | fecha_de_compra |
+--------+------------+--------+-----------------+
|
a02 | silla_mode | 200 | 2009/11/03 |
|
a03 | silla_mode | 400 | 2009/11/03 |
+--------+------------+--------+-----------------+
2 rows in
set (0.00 sec)
mysql>
select nombre,nombre,precio,fecha_decompra from productos where precio>433;
mysql> select nombre,precio from productos where
precio>433;
Empty set (0.00 sec)
mysql> alter table productos add categoria
varchar(10);
Query OK, 5 rows affected (0.18 sec)
Records: 5
Duplicates: 0 Warnings: 0
mysql> update productos set categoria='utensilio';
Query OK, 5 rows affected (0.00 sec)
Rows matched: 5
Changed: 5 Warnings: 0
mysql> update productos set categoria='mueble';
Query OK, 5 rows affected (0.00 sec)
Rows matched: 5
Changed: 5 Warnings: 0
mysql> update productos set categoria='mueble';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 5
Changed: 0 Warnings: 0
Ejercicio 3
mysql> create database producto1;
Query OK, 1 row affected (0.11 sec)
mysql>
use producto1;
Database
changed
mysql>
create table productos(codigo varchar(3),nombre varchar(30),precio decimal(6,2),fechaalta
date,primary key (codigo));
Query OK, 0 rows affected (0.08 sec)
mysql> insert into productos
values('a01','Afilador','2.50','200-11-02');
Query OK, 1 row affected (0.00 sec)
mysql> insert into productos values('s01','Silla
mod.ZAZ','25','2007-11-03');
Query OK, 1 row affected (0.00 sec)
mysql> insert into productos values('s02','Silla
mod.XAX','25','2007-11-03');
Query OK, 1 row affected (0.00 sec)
mysql>
select* from productos;
+--------+---------------+--------+------------+
| codigo
| nombre | precio | fechaalta |
+--------+---------------+--------+------------+
|
a01 | Afilador |
2.50 | 0200-11-02 |
|
s01 | Silla mod.ZAZ | 25.00 | 2007-11-03 |
| s02 | Silla
mod.XAX | 25.00 | 2007-11-03 |
+--------+---------------+--------+------------+
3 rows in set (0.00 sec)
mysql> select* from productos where
nombre='Afilador';
+--------+----------+--------+------------+
| codigo
| nombre | precio | fechaalta |
+--------+----------+--------+------------+
|
a01 | Afilador | 2.50 | 0200-11-02 |
+--------+----------+--------+------------+
1 row in set (0.00 sec)
mysql> select* from productos where nombre like
'S%';
+--------+---------------+--------+------------+
| codigo
| nombre | precio | fechaalta |
+--------+---------------+--------+------------+
|
s01 | Silla mod.ZAZ | 25.00 | 2007-11-03 |
| s02 | Silla
mod.XAX | 25.00 | 2007-11-03 |
+--------+---------------+--------+------------+
2 rows in set (0.00 sec)
mysql>
select nombre,precio from productos where precio>22;
+---------------+--------+
|
nombre | precio |
+---------------+--------+
| Silla
mod.ZAZ | 25.00 |
| Silla
mod.XAX | 25.00 |
+---------------+--------+
2 rows in set (0.00 sec)
mysql> select avg(precio) from productos where
left(nombre,5)='Silla';
+-------------+
| avg(precio) |
+-------------+
| 25.000000 |
+-------------+
1 row in set (0.00 sec)
mysql> alter table productos add categoria
varchar(10);
Query OK, 3 rows affected (0.20 sec)
Records: 3
Duplicates: 0 Warnings: 0
mysql> update productos set
categoria="silla" where left(nombre,5) 0 'silla';
mysql> update productos set categoria='utensilio';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3
Changed: 3 Warnings: 0
mysql> update productos set
categoria="Sill" where left(nombre,5)='Silla';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2
Changed: 2 Warnings: 0
mysql> select distinct categoria from productos;
+-----------+
| categoria |
+-----------+
| utensilio |
| Silla |
+-----------+
2 rows in set (0.00 sec)
mysql> select categoria, count(*) from productos
group by categoria;
+-----------+----------+
| categoria | count(*) |
+-----------+----------+
| Sill
| 2 |
| utensilio |
1 |
+-----------+----------+
2 rows in set (0.00 sec)
No hay comentarios.:
Publicar un comentario