En esta segunda practica se encuentra el video con la
explicación de la dase de datos notas.
Aquí se encuentra el link del video y en la parte de
abajo la sintaxis por si encuentra una duda.
https://www.youtube.com/watch?v=Evw_98o_80k&feature=youtu.be
Enter password: ***
Welcome to
the MySQL monitor. Commands end with ;
or \g.
Your MySQL
connection id is 3
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 notas;
Query OK, 1
row affected (0.07 sec)
mysql>
use notas;
Database
changed
mysql>
create table alumnos(matricula int not null primary key,nombre
varchar(30),apellidos varchar(50),semestre varchar(20),modulo varchar(50),calif_1
int,calif_2
int,calif_3
int);
Query OK, 0
rows affected (0.15 sec)
mysql> insert into
alumnos(matricula,nombre,apellidos,semestre,modulo,calif_1,calif_2,calif_3)
values(123,'edith','martinez hernandez','cuarto','COBD',8,9,10),(456
'manuel','zavalla
contreras','cuarta','COBD',9,8,7),(678,'irving','gonzalez
mena','cuarto','COBD',7,6,5);
Query OK, 3
rows affected (0.02 sec)
Records:
3 Duplicates: 0 Warnings: 0
mysql>
create view vista_alumnos as select
matricula,nombre,apellidos,(calif_1+calif_2+calif_3)/3 as promedio from
alumnos;
Query OK, 0
rows affected (0.07 sec)
mysql>
show tables;
+-----------------+
|
Tables_in_notas |
+-----------------+
| alumnos |
| vista_alumnos |
+-----------------+
2 rows in set (0.00 sec)
mysql> select * from vista_alumnos;
+-----------+--------+--------------------+----------+
| matricula | nombre | apellidos | promedio |
+-----------+--------+--------------------+----------+
| 123 |
edith | martinez hernandez | 9.0000 |
| 456 | manuel |
zavalla contreras | 8.0000 |
| 678 | irving |
gonzalez mena | 6.0000 |
+-----------+--------+--------------------+----------+
3 rows in
set (0.00 sec)
mysql>
insert into alumnos values(912,'fabian','mora zanchez','cuarto','COBD',10,9,8);
Query OK, 1
row affected (0.00 sec)
mysql> select * from alumnos;
+-----------+--------+--------------------+----------+--------+---------+---------+---------+
| matricula | nombre | apellidos | semestre | modulo | calif_1 |
calif_2 | calif_3 |
+-----------+--------+--------------------+----------+--------+---------+---------+---------+
| 123 |
edith | martinez hernandez | cuarto | COBD
| 8 | 9 |
10 |
| 456 | manuel |
zavalla contreras | cuarta | COBD
| 9 | 8 |
7 |
| 678 | irving |
gonzalez mena | cuarto | COBD
| 7 | 6 |
5 |
| 912 | fabian |
mora zanchez | cuarto | COBD
| 10 | 9 |
8 |
+-----------+--------+--------------------+----------+--------+---------+---------+---------+
4 rows in
set (0.00 sec)
mysql> select * from vista_alumnos;
+-----------+--------+--------------------+----------+
| matricula | nombre | apellidos | promedio |
+-----------+--------+--------------------+----------+
| 123 |
edith | martinez hernandez | 9.0000 |
| 456 | manuel |
zavalla contreras | 8.0000 |
| 678 | irving |
gonzalez mena | 6.0000 |
| 912 | fabian | mora zanchez |
9.0000 |
+-----------+--------+--------------------+----------+
4 rows in
set (0.00 sec)