Sei sulla pagina 1di 4

Enter password: ****

Welcome to the MySQL monitor. Commands end with ; or \g.


Your MySQL connection id is 9
Server version: 5.7.19-log MySQL Community Server (GPL)

Copyright (c) 2000, 2017, 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 database laboratoriosql;


ERROR 1049 (42000): Unknown database 'database'
mysql> use databases laboratoriosql;
ERROR 1049 (42000): Unknown database 'databases'
mysql> use laboratoriosql;
Database changed
mysql> select*from profesor;
+------------+-----------+----------+-----------+----------+
| doc_prof | nom_prof | ape_prof | cate_prof | sal_prof |
+------------+-----------+----------+-----------+----------+
| 1098765789 | alejandra | torres | 4 | 1100000 |
| 13826789 | maritza | angarita | 1 | 550000 |
| 63502720 | martha | rojas | 2 | 690000 |
| 91216904 | carlos | perez | 3 | 950000 |
+------------+-----------+----------+-----------+----------+
4 rows in set (0.00 sec)

mysql> select * from cursos;


ERROR 1146 (42S02): Table 'laboratoriosql.cursos' doesn't exist
mysql> select * from curso;
+----------+-------------------------------+------------+------------+
| cod_curs | nom_curs | horas_curs | valor_curs |
+----------+-------------------------------+------------+------------+
| 149842 | fundamentos de bases de datos | 40 | 500000 |
| 250067 | fundamentos de sql | 20 | 700000 |
| 289011 | manejo de mysql | 45 | 550000 |
| 345671 | fundamentos de oracle | 60 | 3000000 |
+----------+-------------------------------+------------+------------+
4 rows in set (0.00 sec)

mysql> select * from curso where valor_curs>500000;


+----------+-----------------------+------------+------------+
| cod_curs | nom_curs | horas_curs | valor_curs |
+----------+-----------------------+------------+------------+
| 250067 | fundamentos de sql | 20 | 700000 |
| 289011 | manejo de mysql | 45 | 550000 |
| 345671 | fundamentos de oracle | 60 | 3000000 |
+----------+-----------------------+------------+------------+
3 rows in set (0.00 sec)

mysql> select * from estudiantes;


ERROR 1146 (42S02): Table 'laboratoriosql.estudiantes' doesn't exist
mysql> select * from estudiante;
+------------+-------------+----------+----------+
| doc_est | nom_est | ape_est | edad_est |
+------------+-------------+----------+----------+
| 1098098097 | jonatan | ardila | 17 |
| 1098765678 | carlos | martinez | 19 |
| 63502720 | maria | perez | 23 |
| 91245678 | carlos jose | lopez | 25 |
+------------+-------------+----------+----------+
4 rows in set (0.03 sec)

mysql> select * from estudiante where edad_est>22;


+----------+-------------+---------+----------+
| doc_est | nom_est | ape_est | edad_est |
+----------+-------------+---------+----------+
| 63502720 | maria | perez | 23 |
| 91245678 | carlos jose | lopez | 25 |
+----------+-------------+---------+----------+
2 rows in set (0.00 sec)

mysql> select nom_est, edad_est from estudiante;


+-------------+----------+
| nom_est | edad_est |
+-------------+----------+
| jonatan | 17 |
| carlos | 19 |
| maria | 23 |
| carlos jose | 25 |
+-------------+----------+
4 rows in set (0.00 sec)

mysql> select nom_est, edad_est from estudiante where


-> edad_est= (select min(edad_est);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '' at
line 2
mysql> select nom_est, edad_est from estudiante where edad_est=min;
ERROR 1054 (42S22): Unknown column 'min' in 'where clause'
mysql> select min(edad_est) from estudiante;
+---------------+
| min(edad_est) |
+---------------+
| 17 |
+---------------+
1 row in set (0.04 sec)

mysql> select nom_est, min(edad_est) from estudiante;


+---------+---------------+
| nom_est | min(edad_est) |
+---------+---------------+
| jonatan | 17 |
+---------+---------------+
1 row in set (0.00 sec)

mysql> select*from cursos;


ERROR 1146 (42S02): Table 'laboratoriosql.cursos' doesn't exist
mysql> select*from curso;
+----------+-------------------------------+------------+------------+
| cod_curs | nom_curs | horas_curs | valor_curs |
+----------+-------------------------------+------------+------------+
| 149842 | fundamentos de bases de datos | 40 | 500000 |
| 250067 | fundamentos de sql | 20 | 700000 |
| 289011 | manejo de mysql | 45 | 550000 |
| 345671 | fundamentos de oracle | 60 | 3000000 |
+----------+-------------------------------+------------+------------+
4 rows in set (0.00 sec)

mysql> select valor_curs, avg(valor_curs) from curso where horas_curs>40;


+------------+-----------------+
| valor_curs | avg(valor_curs) |
+------------+-----------------+
| 550000 | 1775000.0000 |
+------------+-----------------+
1 row in set (0.04 sec)

mysql> select avg(valor_curs) from curso where horas_curs>40;


+-----------------+
| avg(valor_curs) |
+-----------------+
| 1775000.0000 |
+-----------------+
1 row in set (0.00 sec)

mysql> select * from profesor;


+------------+-----------+----------+-----------+----------+
| doc_prof | nom_prof | ape_prof | cate_prof | sal_prof |
+------------+-----------+----------+-----------+----------+
| 1098765789 | alejandra | torres | 4 | 1100000 |
| 13826789 | maritza | angarita | 1 | 550000 |
| 63502720 | martha | rojas | 2 | 690000 |
| 91216904 | carlos | perez | 3 | 950000 |
+------------+-----------+----------+-----------+----------+
4 rows in set (0.00 sec)

mysql> select avg(sal_prof) from profesor where cate_prof=1;


+---------------+
| avg(sal_prof) |
+---------------+
| 550000.0000 |
+---------------+
1 row in set (0.00 sec)

mysql> select * from curso order by valor_curs asc;


+----------+-------------------------------+------------+------------+
| cod_curs | nom_curs | horas_curs | valor_curs |
+----------+-------------------------------+------------+------------+
| 149842 | fundamentos de bases de datos | 40 | 500000 |
| 289011 | manejo de mysql | 45 | 550000 |
| 250067 | fundamentos de sql | 20 | 700000 |
| 345671 | fundamentos de oracle | 60 | 3000000 |
+----------+-------------------------------+------------+------------+
4 rows in set (0.00 sec)

mysql> select nom_prof, min(sal_prof) from profesor;


+-----------+---------------+
| nom_prof | min(sal_prof) |
+-----------+---------------+
| alejandra | 550000 |
+-----------+---------------+
1 row in set (0.00 sec)

mysql> select estudiante.nom_est, estudiante.doc_est, curso.cod_curs,


curso.nom_curs, curso.horas_curs, curso.valor_curs estudiantexcurso.fec_ini_estcur
from estudiante,c
urso,estudiantexcuros where fec_ini_estcur=20110201;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'.fec_ini_estcur
from estudiante,curso,estudiantexcuros where fec_ini_estcur=2011' at line 1
mysql> select estudiante.nom_est, estudiante.doc_est, curso.cod_curs,
curso.nom_curs, curso.horas_curs, curso.valor_curs estudiantexcurso.fec_ini_estcur
from estudiante,c
urso,estudiantexcuros where fec_ini_estcur=20110201;

Potrebbero piacerti anche