Server Version
Enviado por lauraurora • 29 de Octubre de 2012 • Informe • 770 Palabras (4 Páginas) • 357 Visitas
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.45-community-nt-log MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> create database h;
Query OK, 1 row affected (0.03 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| h |
| mysql |
| phpmyadmin |
| test |
+--------------------+
5 rows in set (0.02 sec)
mysql> use h;
Database changed
mysql> CREATE TABLE PRODUCTO(ID_PRO INT PRIMARY KEY NOT NULL AUTO_INCREMENT, NOMBRE VARCHAR(30),PRECIO_UNIDAD INT);
Query OK, 0 rows affected (0.03 sec)
mysql> drop table PRODUCTO;
Query OK, 0 rows affected (0.02 sec)
mysql> CREATE TABLE PRODUCTO( ID_PRO INT PRIMARY KEY NOT NULL AUTO_INCREMENT, NOMBRE VARCHAR(30), PRECIO_UNIDAD INT);
Query OK, 0 rows affected (0.03 sec)
mysql> CREATE TABLE DETALLE_PEDIDO(ID INT PRIMARY KEY NOT NULL AUTO_INCREMENT, ID_PRODUCTO INT, FOREIGN KEY(ID_PRODUCTO) REFERENCES PRODUCTO(ID), PRECIO_UNI INT, FOREIGN KEY (PRECIO_UNI) REFERENCES PRODUCTO (PRECIO_UNIDAD), DESCUENTO DECIMAL(10,2));
Query OK, 0 rows affected (0.03 sec)
mysql> SHOW TABLES;
+----------------+
| Tables_in_h |
+----------------+
| detalle_pedido |
| producto |
+----------------+
2 rows in set (0.00 sec)
mysql> INSERT INTO PRODUCTO VALUES( NULL, 'MANTEQUILLA',31);
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO PRODUCTO VALUES( NULL, 'ARROZ',60);
Query OK, 1 row affected (0.01 sec)
mysql> INSERT INTO PRODUCTO VALUES( NULL, 'FRIJOL',20);
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO PRODUCTO VALUES( NULL, 'MAYONESA',10);
Query OK, 1 row affected (0.00 sec)
mysql> SELECT*FROM PRODUCTO;
+--------+-------------+---------------+
| ID_PRO | NOMBRE | PRECIO_UNIDAD |
+--------+-------------+---------------+
| 1 | MANTEQUILLA | 31 |
| 2 | ARROZ | 60 |
| 3 | FRIJOL | 20 |
| 4 | MAYONESA | 10 |
+--------+-------------+---------------+
4 rows in set (0.00 sec)
mysql> INSERT INTO DETALLE_PEDIDO VALUES(NULL, 1,5,.10);
Query OK, 1 row affected (0.00
...