TALLER # 3 BIBLIOTECA

Microsoft Windows XP [Versión 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Administrador>cd..

C:\Documents and Settings>cd..

C:\>cd Archivos de programa\EasyPHP3.1\mysql\bin

C:\Archivos de programa\EasyPHP3.1\mysql\bin>mysql -h localhost -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.35-community-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database biblioteca;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| biblioteca |
| mysql |
| phpmyadmin |
+--------------------+
4 rows in set (0.00 sec)

mysql> use biblioteca;
Database changed
mysql> create table usuario(idusuario varchar(20) not null,
nom varchar(30) not null,ap varchar(30) not null,
dir varchar(30) not null,
tel varchar(30),primary key(idusuario));
Query OK, 0 rows affected (0.03 sec)

mysql> show tables;
+----------------------+
| Tables_in_biblioteca |
+----------------------+
| usuario |
+----------------------+
1 row in set (0.00 sec)

mysql> create table autor(idautor varchar(20) not null,
nom varchar(30) not null,
ap varchar(30) not null,
nacionalidad varchar(30) not null,primary key(idautor));
Query OK, 0 rows affected (0.03 sec)

mysql> show tables;
+----------------------+
| Tables_in_biblioteca |
+----------------------+
| autor |
| usuario |
+----------------------+
2 rows in set (0.00 sec)

mysql> create table editorial(ideditorial varchar(20) not null,
nom varchar(30) not null,
pais varchar(30) not null,primary key(ideditorial));
Query OK, 0 rows affected (0.05 sec)

mysql> show tables;
+----------------------+
| Tables_in_biblioteca |
+----------------------+
| autor |
| editorial |
| usuario |
+----------------------+
3 rows in set (0.00 sec)

mysql> create table libro(Idlibro varchar(20) not null,
titulo varchar(30) not null,
numpag varchar(100) not null,
idautor varchar(30) not null,
ideditorial varchar(30) not null,primary key (idlibro),
foreign key (idautor) references autor(idautor),
foreign key (ideditorial) references editorial(ideditorial));
Query OK, 0 rows affected (0.05 sec)

mysql> show tables;
+----------------------+
| Tables_in_biblioteca |
+----------------------+
| autor |
| editorial |
| libro |
| usuario |
+----------------------+
4 rows in set (0.00 sec)

mysql> create table prestamo(Idusuario varchar (20) not null,t
idlibro varchar (30) not null,
fechaprestamo varchar (30) not null,
horaprestamo varchar (30) not null,primary key (idlibro),
fechaentraga varchar (30) not null,
foreign key (idlibro) references libro(idlibro),
foreign key (idusuario) references usuario(idusuario));
Query OK, 0 rows affected (0.03 sec)

mysql> show tables;
+----------------------+
| Tables_in_biblioteca |
+----------------------+
| autor |
| editorial |
| libro |
| prestamo |
| usuario |
+----------------------+
5 rows in set (0.01 sec)

mysql>
Powered By Blogger

¿como te ha parecio este blog ?


¿Que les parece mi mascota?