PRACTICA 2
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.51b-community-nt-log MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>create database biblioteca;
Query OK, 1 row affected (0.00 sec)
mysql>create table autor(codigo integer primary key,nombre varchar(20));
Query OK, 0 rows affected (0.16 sec)
mysql> create table libro(codigo integer primary key,titulo varchar(20),isbn varchar(20),editorial varchar(20),paginas integer,ano_de_edicion date);
Query OK, 0 rows affected (0.13 sec)
mysql> create table ejemplar(codigo integer primary key,localizacion varchar(20));
Query OK, 0 rows affected (0.06 sec)
mysql> create table usuario(codigo integer primary key,nombre varchar(20),telefono varchar(20),direccion varchar(20));
Query OK, 0 rows affected (0.14 sec)
mysql> create table escribe(codigo_autor integer primary key,codigo_libro integer);
Query OK, 0 rows affected (0.06 sec)
mysql> create table saca(codigo_usuario integer primary key,codigo_ejemplar integer,fecha_devolucion date,fecha_prestamo date);
Query OK, 0 rows affected (0.06 sec)
mysql> create table temporal(codigo integer,prueba varchar(20));
Query OK, 0 rows affected (0.13 sec)
mysql> create table borrar(codigo integer,prueba varchar(20));
Query OK, 0 rows affected (0.09 sec)
Practica 6
mysql>insert into autor values(01,'martin lopez');
Query OK, 1 row affected (0.24 sec)
mysql>insert into autor values(02,'karla martinez');
Query OK, 1 row affected (0.00 sec)
mysql> select * from autor;
+--------+----------------+
| codigo | nombre |
+--------+----------------+
| 1 | martin lopez |
| 2 | karla martinez |
+--------+----------------+
2 rows in set (0.19 sec)
mysql> insert into libro values(20,'los tres mosqueteros','ltm01','santillana',10,’ 2015/04/04’);
Query OK, 1 row affected (0.00 sec)
mysql>insert into libro values(22,'la cenicienta','lc02','santillana',15,’ 2015/04/06’);
Query OK, 1 row affected (0.00 sec)
mysql> select * from libro;
+--------+----------------------+-------+------------+---------+----------------+
| codigo | titulo | isbn | editorial | paginas | ano_de_edicion |
+--------+----------------------+-------+------------+---------+----------------+
| 20 | los tres mosqueteros | ltm01 | santillana | 10 | 2015-04-04 |
| 22 | la cenicienta | lc02 | santillana | 15 | 2015-04-06 |
+--------+----------------------+-------+------------+---------+----------------+
2 rows in set (0.00 sec)
mysql>insert into ejemplar values(4554,'cautitlan');
Query OK, 1 row affected (0.00 sec)
mysql>insert into ejemplar values(6565,'cautitlan');
Query OK, 1 row affected (0.00 sec)
mysql> select * from ejemplar;
+--------+--------------+
| codigo | localizacion |
+--------+--------------+
| 4554 | cautitlan |
| 6565 | cautitlan |
+--------+--------------+
2 rows in set (0.00 sec)
mysql> insert into usuario values(5635,'luis gonzalez','55-458-578','av.toltecas’,’#45' ,'tultitlan','estado de mexico',225523);
Query OK, 1 row affected (0.00 sec)
mysql> insert into usuario values(9472,'perla jimenez','55-568-962', 'cipreses','#56','cautitlan','estado de mexico',353415);
Query OK, 1 row affected (0.00 sec)
mysql> select * from usuario;
+--------+---------------+------------+-------------+--------+-----------+-------------------+---------------+
| codigo | nombre | telefono | calle | numero | colonia | ciudad | codigo_postal |
+--------+---------------+------------+-------------+--------+-----------+-------------------+---------------+
| 5635 | luis gonzalez | 55-458-578 | av.toltecas | #45 | tultitlan | estado de mexico | 225523 |
| 9472 | perla jimenez | 55-568-962 | cipreses | #56 | cautitlan | estado de mexico | 353415 |
+--------+---------------+------------+-------------+--------+-----------+-------------------+---------------+
2 rows in set (0.00 sec)
mysql>insert into escribe values(556577,2486756);
Query OK, 1 row affected (0.00 sec)
mysql>insert into escribe values(554866,4554245);
Query OK, 1 row affected (0.00 sec)
mysql>insert into saca values(58968767,445755486,'2015/03/22','2014/09/03');
Query OK, 1 row affected (0.00 sec)
mysql>insert into saca values(45854557,6541568521,'2015/04/14','2014/09/22');
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql>insert into temporal values(2662525,'mantenimiento');
Query OK, 1 row affected (0.00 sec)
mysql>insert into temporal values(6568444,'laboral');
Query OK, 1 row affected (0.00 sec)
Practica 7
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.51b-community-nt-log MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| biblioteca |
| mysql |
| phpmyadmin |
| test |
+--------------------+
5 rows in set (0.01 sec)
mysql>use biblioteca;
Database changed
mysql>delete from temporal where codigo=2662525;
Query OK, 1 row affected (0.00 sec)
mysql> select * from temporal;
+---------+---------+
| codigo | prueba |
+---------+---------+
| 6568444 | laboral |
+---------+---------+
1 row in set (0.00 sec)
Practica 8
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.51b-community-nt-log MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>use biblioteca;
Database changed
mysql>select * from usuario;
+--------+---------------+------------+-----------------+
| codigo | nombre | telefono | direccion |
+--------+---------------+------------+-----------------+
| 5635 | luis gonzalez | 55-458-578 | av.toltecas #45 |
| 9472 | perla jimenez | 55-568-962 | gsutavo baz #56 |
+--------+---------------+------------+-----------------+
2 rows in set (0.00 sec)
mysql> update usuario set nombre='luis gonzalez' where nombre='Luis gonzalez';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0
mysql>select * from usuario;
+--------+---------------+------------+-----------------+
| codigo | nombre | telefono | direccion |
+--------+---------------+------------+-----------------+
| 5635 | Luis gonzalez | 55-458-578 | av.toltecas #45 |
| 9472 | perla jimenez | 55-568-962 | gsutavo baz #56 |
No hay comentarios.:
Publicar un comentario