Advertisement
Guest User

Untitled

a guest
Aug 28th, 2018
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.37 KB | None | 0 0
  1. Enter password: *********
  2. Welcome to the MySQL monitor. Commands end with ; or \g.
  3. Your MySQL connection id is 4
  4. Server version: 5.7.18-log MySQL Community Server (GPL)
  5.  
  6. Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  7.  
  8. Oracle is a registered trademark of Oracle Corporation and/or its
  9. affiliates. Other names may be trademarks of their respective
  10. owners.
  11.  
  12. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  13.  
  14. mysql> show databases;
  15. +--------------------+
  16. | Database |
  17. +--------------------+
  18. | information_schema |
  19. | mysql |
  20. | performance_schema |
  21. | sakila |
  22. | sys |
  23. | videoclub |
  24. | videojuegos |
  25. | world |
  26. +--------------------+
  27. 8 rows in set (0.00 sec)
  28.  
  29. mysql> create database UVM;
  30. Query OK, 1 row affected (0.00 sec)
  31.  
  32. mysql> create table alumno(cuenta varchar(10) not null, nombre varchar(40) not null, telefono varchar(15) not null, email varchar(30) not null, nivel int unsigned not null, carrera varchar(5) not null, materia varchar(30) not null, calificacion int unsigned not null, promedio int unsigned not null);
  33. ERROR 1046 (3D000): No database selected
  34. mysql> use UVM
  35. Database changed
  36. mysql> create table alumno(cuenta varchar(10) not null, nombre varchar(40) not null, telefono varchar(15) not null, email varchar(30) not null, nivel int unsigned not null, carrera varchar(5) not null, materia varchar(30) not null, calificacion int unsigned not null, promedio int unsigned not null);
  37. Query OK, 0 rows affected (0.31 sec)
  38.  
  39. mysql> create table docente(clave varchar(10) not null, nombre varchar(40) not null, telefono varchar(15) not null, email varchar(30) not null, profesion varchar(20) not null, grado int unsigned not null, materia varchar(30) not null, cuatrimestre int unsigned not null);
  40. Query OK, 0 rows affected (0.19 sec)
  41.  
  42. mysql> insert into alumno(cuenta, nombre, telefono, email, nivel, carrera, materia, calificacion, promedio) values ('340319185','Santiago Garza','5543228522','sg@mail.com',3,'ISC','Bases de Datos',10,9);
  43. Query OK, 1 row affected (0.05 sec)
  44.  
  45. mysql> insert into alumno(cuenta, nombre, telefono, email, nivel, carrera, materia, calificacion, promedio) values ('340311065','Alumno 2','7347232552','ratz@mail.com',2,'ISC','Bases de Datos',7,8);
  46. Query OK, 1 row affected (0.05 sec)
  47.  
  48. mysql> insert into docente(clave, nombre, telefono, email, profesion, grado, materia, cuatrimestre) values ('D08217653','Javier','5585346798','docente@mail.com','Ing en Sistemas',3,'Bases de Datos',4);
  49. Query OK, 1 row affected (0.02 sec)
  50.  
  51. mysql> insert into docente(clave, nombre, telefono, email, profesion, grado, materia, cuatrimestre) values ('D54643653','Docente 2','234346798','docente2@mail.com','Ing en Sistemas',2,'Bases de Datos',4);
  52. Query OK, 1 row affected (0.05 sec)
  53.  
  54. mysql> select * from alumno;
  55. +-----------+----------------+------------+---------------+-------+---------+----------------+--------------+----------+
  56. | cuenta | nombre | telefono | email | nivel | carrera | materia | calificacion | promedio |
  57. +-----------+----------------+------------+---------------+-------+---------+----------------+--------------+----------+
  58. | 340319185 | Santiago Garza | 5543228522 | sg@mail.com | 3 | ISC | Bases de Datos | 10 | 9 |
  59. | 340311065 | Alumno 2 | 7347232552 | ratz@mail.com | 2 | ISC | Bases de Datos | 7 | 8 |
  60. +-----------+----------------+------------+---------------+-------+---------+----------------+--------------+----------+
  61. 2 rows in set (0.00 sec)
  62.  
  63. mysql> select * from docente;
  64. +-----------+-----------+------------+-------------------+-----------------+-------+----------------+--------------+
  65. | clave | nombre | telefono | email | profesion | grado | materia | cuatrimestre |
  66. +-----------+-----------+------------+-------------------+-----------------+-------+----------------+--------------+
  67. | D08217653 | Javier | 5585346798 | docente@mail.com | Ing en Sistemas | 3 | Bases de Datos | 4 |
  68. | D54643653 | Docente 2 | 234346798 | docente2@mail.com | Ing en Sistemas | 2 | Bases de Datos | 4 |
  69. +-----------+-----------+------------+-------------------+-----------------+-------+----------------+--------------+
  70. 2 rows in set (0.00 sec)
  71.  
  72. mysql> select nombre from docente where (cuatrimestre=4);
  73. +-----------+
  74. | nombre |
  75. +-----------+
  76. | Javier |
  77. | Docente 2 |
  78. +-----------+
  79. 2 rows in set (0.00 sec)
  80.  
  81. mysql> select cuenta, nombre from docente where (carrera like 'ISC');
  82. ERROR 1054 (42S22): Unknown column 'cuenta' in 'field list'
  83. mysql> select cuenta, nombre from alumno where (carrera like 'ISC');
  84. +-----------+----------------+
  85. | cuenta | nombre |
  86. +-----------+----------------+
  87. | 340319185 | Santiago Garza |
  88. | 340311065 | Alumno 2 |
  89. +-----------+----------------+
  90. 2 rows in set (0.00 sec)
  91.  
  92. mysql> select *;
  93. ERROR 1096 (HY000): No tables used
  94. mysql> show tables;
  95. +---------------+
  96. | Tables_in_uvm |
  97. +---------------+
  98. | alumno |
  99. | docente |
  100. +---------------+
  101. 2 rows in set (0.00 sec)
  102.  
  103. mysql> drop table docente
  104. -> ;
  105. Query OK, 0 rows affected (0.14 sec)
  106.  
  107. mysql> show tables;
  108. +---------------+
  109. | Tables_in_uvm |
  110. +---------------+
  111. | alumno |
  112. +---------------+
  113. 1 row in set (0.00 sec)
  114.  
  115. mysql> show databases;
  116. +--------------------+
  117. | Database |
  118. +--------------------+
  119. | information_schema |
  120. | mysql |
  121. | performance_schema |
  122. | sakila |
  123. | sys |
  124. | uvm |
  125. | videoclub |
  126. | videojuegos |
  127. | world |
  128. +--------------------+
  129. 9 rows in set (0.00 sec)
  130.  
  131. mysql> drop database videoclub;
  132. Query OK, 1 row affected (0.13 sec)
  133.  
  134. mysql> show databases;
  135. +--------------------+
  136. | Database |
  137. +--------------------+
  138. | information_schema |
  139. | mysql |
  140. | performance_schema |
  141. | sakila |
  142. | sys |
  143. | uvm |
  144. | videojuegos |
  145. | world |
  146. +--------------------+
  147. 8 rows in set (0.00 sec)
  148.  
  149. mysql> alter table alumno ADD porcentaje_avance int unsigned not null;
  150. Query OK, 0 rows affected (0.67 sec)
  151. Records: 0 Duplicates: 0 Warnings: 0
  152.  
  153. mysql> select * from alumno;
  154. +-----------+----------------+------------+---------------+-------+---------+----------------+--------------+----------+-------------------+
  155. | cuenta | nombre | telefono | email | nivel | carrera | materia | calificacion | promedio | porcentaje_avance |
  156. +-----------+----------------+------------+---------------+-------+---------+----------------+--------------+----------+-------------------+
  157. | 340319185 | Santiago Garza | 5543228522 | sg@mail.com | 3 | ISC | Bases de Datos | 10 | 9 | 0 |
  158. | 340311065 | Alumno 2 | 7347232552 | ratz@mail.com | 2 | ISC | Bases de Datos | 7 | 8 | 0 |
  159. +-----------+----------------+------------+---------------+-------+---------+----------------+--------------+----------+-------------------+
  160. 2 rows in set (0.00 sec)
  161.  
  162. mysql> UPDATE alumno
  163. -> SET porcentaje_avance = 100
  164. -> WHERE promedio = 9;
  165. Query OK, 1 row affected (0.05 sec)
  166. Rows matched: 1 Changed: 1 Warnings: 0
  167.  
  168. mysql> UPDATE alumno
  169. -> SET porcentaje_avance = 80
  170. -> WHERE promedio = 8;
  171. Query OK, 1 row affected (0.02 sec)
  172. Rows matched: 1 Changed: 1 Warnings: 0
  173.  
  174. mysql> select * from alumno;
  175. +-----------+----------------+------------+---------------+-------+---------+----------------+--------------+----------+-------------------+
  176. | cuenta | nombre | telefono | email | nivel | carrera | materia | calificacion | promedio | porcentaje_avance |
  177. +-----------+----------------+------------+---------------+-------+---------+----------------+--------------+----------+-------------------+
  178. | 340319185 | Santiago Garza | 5543228522 | sg@mail.com | 3 | ISC | Bases de Datos | 10 | 9 | 100 |
  179. | 340311065 | Alumno 2 | 7347232552 | ratz@mail.com | 2 | ISC | Bases de Datos | 7 | 8 | 80 |
  180. +-----------+----------------+------------+---------------+-------+---------+----------------+--------------+----------+-------------------+
  181. 2 rows in set (0.01 sec)
  182.  
  183. mysql>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement