jueves, 21 de marzo de 2013

17,18,19


Actividad 19
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> create user Propietario identified by 'Prop1';
Query OK, 0 rows affected (0.02 sec)

mysql> create user Veterinario identified by 'Vet1';
Query OK, 0 rows affected (0.01 sec)

mysql> create user Asistente identified by 'Asis1';
Query OK, 0 rows affected (0.00 sec)

mysql> select  user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.04 sec)

mysql> grant all privileges on veterinaria.* to 'Propietario'with grant option;
Query OK, 0 rows affected (0.10 sec)

mysql> grant insert,update,delete,select  on veterinaria.* to 'Veterinario'@'localhost';
Query OK, 0 rows affected (1.35 sec)

mysql> grant all privileges on veterinaria.* to 'Propietario'with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> grant insert,update,delete,select  on veterinaria.* to 'Veterinario'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> grant select  on veterinaria.* to 'Asistente'@'localhost';
Query OK, 0 rows affected (0.01 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cdcol              |
| mysql              |
| performance_schema |
| phpmyadmin         |
| test               |
| webauth            |
+--------------------+
7 rows in set (0.91 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cdcol              |
| mysql              |
| performance_schema |
| phpmyadmin         |
| test               |
| veterinaria            |
| webauth            |
+--------------------+
8 rows in set (0.01 sec)

mysql> use veterinaria;
Database changed

mysql> select user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.11 sec)

mysql> exit




Actividad 18
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.5.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> use veterinaria;
Database changed

mysql> select*from Pacientes;
+------------+-----------------+----------------------+----------+--------------+
| IDPaciente | Nombre         | Direccion            | Telefono | Empleo       |
+------------+-----------------+----------------------+----------+--------------+
|          2 | Alexa Carlos | Miravalle 7806         | 123456  | Estudiante    |
|          3 | Ricardo Alvarez      | Oasis 8656        | 674654  | Estudiante |
|          1 | Melissa Aguilar    | Girasoles 7445 | 0875444  | Estudiante  |
+------------+-----------------+----------------------+----------+--------------+
3 rows in set (0.21 sec)

mysql> insert into Pacientes values(04,'Alonso Carrillo','Trigo 8654','9653486,'Estudiante');
Query OK, 1 row affected (0.01 sec)

mysql> insert into Pacientes values(05,'Jessica Barrios','Colina Alta 1234','9755456','Estudiante');
Query OK, 1 row affected (0.01 sec)

mysql> select*from Pacientes;
+------------+-----------------+----------------------+----------+--------------+
| IDPaciente | Nombre         | Direccion            | Telefono | Empleo         |
+------------+-----------------+----------------------+----------+--------------+
|          2 | Alexa Carlos | Miravalle 7806         | 123456  | Estudiante       |
|          3 | Ricardo Alvarez      | Oasis 8656        | 674654  | Estudiante |
|          1 | Melissa Aguilar    | Girasoles 7445 | 0875444  | Estudiante  |
|          4 | Alonso Carrillo    | Trigo 8654     | 9653486  | Estudiante    |
|          5 | Jessica Barrios | Colina Alta 1234      | 9755456  | Estudiante    |
+------------+-----------------+----------------------+----------+--------------+
5 rows in set (0.01 sec)

mysql> select*from Mascota;
+------+--------+------+------+--------------+-------------+
| IDmascota | nombre | peso | sexo | raza         | fecha_nac |
+------+--------+------+------+--------------+-------------+
|    1 | Lluvia    5 | F    | French poodle      | 5-12-2010  |
|    2 | Bombon | 20 | F    | San bernardo | 8-6-2011  |
+------+--------+------+------+--------------+-------------+
2 rows in set (0.15 sec)

mysql> insert into Mascota values(3,'Daisy',3,'F','chihuahua','10-7-2011');
Query OK, 1 row affected (0.00 sec)

mysql> insert into Mascota values(4,'cacho',6,'M','Hasky','23-9-2010');
Query OK, 1 row affected (0.00 sec)

mysql> insert into Mascota values(5,'Negro',6,'M','Pitbull ','12-10-2009');
Query OK, 1 row affected (0.00 sec)

mysql> select*from Mascota;
+------+--------+------+------+----------------+-------------+
| Idmascota | nombre | peso | sexo | raza           | fecha_nac |
+------+--------+------+------+----------------+-------------+
|    1 | Lluvia    5 | F    | French poodle      | 5-12-2010  |
|    2 |  Bombon | 20 | F    | San bernardo | 8-6-2011   |
|    3 | Daisy   |   3 | F    | chihuahua       | 10-7-2011  |
|    4 | cacho  |    6 | M    | Hasky      | 23-9-2010  |
|    5 | Negro |  6 | M    |Pitbull  | 12-10-2009  |
+------+--------+------+------+----------------+-------------+
5 rows in set (0.00 sec)

mysql> show tables;
+-------------------+
| Tables_in_veterin |
+-------------------+
| Ant_enf   |
| Carac   |
| Pacientes          |
| Historial          |
| Mascota           |
| mconsulta         |
| servicios         |
+-------------------+
10 rows in set (0.71 sec)

mysql> exit
























Actividad 17
Tipo de dato
Tamaño en bytes (máximo)
Cantidad de estos
Tamaño total
CHAR(15)
15
2
30
VARCHAR(25)
26
4
104
CHAR(15)
15
1
15
VARCHAR(20)
21
5
105
INT
4
5
20
VARCHAR(15)
16
1
16
BOOL
1
6
6
ENUM
1
5
5
DATE
3
3
9
VARCHAR(25)
26
3
78


SubTotal
388


Cantidad de repeticiones
100


TOTAL
38800

No hay comentarios:

Publicar un comentario