Vous êtes sur la page 1sur 8

SSSTI SOFTWARE PARA LA SISTEMATIZACIN DE SERVICIOS TEXTILES E INVENTARIOS

Versin 1.0

LABORATORIO 12.
Aplicando Sentencias SQL para la definicin y
manipulacin de la Base de Datos
estudiante: leidy viviana posada alvarez
mysql: [Warning] C:\Program Files (x86)\MySQL\MySQL Server 5.7\bin\mysql.exe:
ignoring option '--no-beep' due to invalid value ''
Enter password: *************
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 5.7.17-log MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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 laboratoriosql;
Database changed
mysql> show tables;
+-----------------------------------+
| Tables_in_laboratoriosql |
+----------------------------------+
| articulo |
| articuloxpedido |
| aseguramientos |
| automotores |
| cliente |
| compaia |
| curso |
| estudiante |
| estudiantexcurso |
| incidentes |
| pedido |
| profesor |
| tiposautomotores |
+-----------------------------+
13 rows in set (0.01 sec)
isertar datos en las tablas.
mysql> insert into profesor values ("63502720","martha","rojas",2,690000);
Query OK, 1 row affected (0.20 sec)

mysql> insert into profesor values ("91216904","carlos","perez",3,950000);


Query OK, 1 row affected (0.06 sec)

mysql> insert into profesor values ("13826789","maritza","angarita",1,550000);


Query OK, 1 row affected (0.03 sec)

mysql> insert into profesor values ("1098765789","alejandra","torres",4,1100000);


Query OK, 1 row affected (0.03 sec)

mysql> select * profesor;


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
'profesor' at line 1
mysql> select * from profesor;
+--------------+---------------+------------+-------------+----------+
| doc_prof | nom_prof | ape_prof | cate_pro | 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.03 sec)

mysql> insert into curso values (149842,"fundamentos de bases de datos",40,500000);


Query OK, 1 row affected (0.11 sec)

mysql> insert into curso values (250067,"fundamentos de sql",20,700000);


Query OK, 1 row affected (0.05 sec)

mysql> insert into curso values (289011,"manejo de mysql",45,550000);


Query OK, 1 row affected (0.04 sec)

mysql> insert into curso values (345671,"fundamentals of oracle",60,3000000);


Query OK, 1 row affected (0.03 sec)

mysql> selec * from curso;


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 'selec *
from curso' at line 1
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 | fundamentals of oracle | 60 | 3000000 |
+----------+-------------------------------+------------+------------+
4 rows in set (0.00 sec)
mysql>
mysql> insert into estudiante values (63502720,"maria","perez",23);
Query OK, 1 row affected (0.08 sec)

mysql> insert into estudiante values (91245678,"carlos jose","lopez",25);


Query OK, 1 row affected (0.05 sec)

mysql> insert into estudiante values (1098098097,"jonatan","ardila",17);


Query OK, 1 row affected (0.02 sec)

mysql> insert into estudiante values (1098765678,"carlos","martinez",19);


Query OK, 1 row affected (0.02 sec)
mysql> select* from estudiante;
+------------+-------------+----------+----------+
| doc_est | nom_est | ape_est | edad_est |
+------------+-------------+----------+----------+
| 63502720 | maria | perez | 23 |
| 91245678 | carlos jose | lopez | 25 |
| 1098098097 | jonatan | ardila | 17 |
| 1098765678 | carlos | martinez | 19 |
+------------+-------------+----------+----------+
4 rows in set (0.00 sec)
mysql> insert into estudiantexcurso values (289011,1098765678,01/02/2011);
Query OK, 1 row affected (0.10 sec)

mysql> insert into estudiantexcurso values (149842,91245678,01/03/2011);


Query OK, 1 row affected (0.05 sec)

mysql> insert into estudiantexcurso values (345671,1098098097,01/02/2011);


Query OK, 1 row affected (0.02 sec)

mysql> insert into estudiantexcurso values (250067,63502720,01/03/2011);


Query OK, 1 row affected (0.05 sec)

mysql> select * fron estudiantexcueso;


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 'fron
estudiantexcueso' at line 1
mysql> select *from estudiantexcurso;
+----------------+----------------+----------------+
| cod_cur_estcur | doc_est_estcur | fec_ini_estcur |
+----------------+----------------+----------------+
| 250067 | 63502720 | 0000-00-00 |
| 149842 | 91245678 | 0000-00-00 |
| 345671 | 1098098097 | 0000-00-00 |
| 289011 | 1098765678 | 0000-00-00 |
+----------------+----------------+----------------+
4 rows in set (0.00 sec)
mysql> insert into pedido(id_ped,id_cli_ped,fec_ped,val_ped)
values(1,"63502718",25/02/2012,120000);
Query OK, 1 row affected (0.05 sec)

mysql> insert into pedido(id_ped,id_cli_ped,fec_ped,val_ped)


values(2,"77191956",30/04/2012,55000);
Query OK, 1 row affected (0.07 sec)

mysql> insert into pedido(id_ped,id_cli_ped,fec_ped,val_ped)


values(3,"63502718",10/12/2011,260000);
Query OK, 1 row affected (0.03 sec)

mysql> insert into pedido(id_ped,id_cli_ped,fec_ped,val_ped)


values(4,"1098765789",25/02/2012,1800000);
Query OK, 1 row affected (0.04 sec)

mysql> selec* from pedido;


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 'selec*
from pedido' at line 1
mysql> select* from pedido;
+--------+------------+------------+---------+
| id_ped | id_cli_ped | fec_ped | val_ped |
+--------+------------+------------+---------+
| 1 | 63502718 | 0000-00-00 | 120000 |
| 2 | 77191956 | 0000-00-00 | 55000 |
| 3 | 63502718 | 0000-00-00 | 260000 |
| 4 | 1098765789 | 0000-00-00 | 1800000 |
+--------+------------+------------+---------+
4 rows in set (0.00 sec)mysql> insert into articulxpedido values (1,3,5,40000);
ERROR 1146 (42S02): Table 'laboratoriosql.articulxpedido' doesn't exist
mysql> insert into articuloxpedido values (1,3,5,40000);
Query OK, 1 row affected (0.07 sec)

mysql> insert into articuloxpedido values (1,4,12,55000);


Query OK, 1 row affected (0.07 sec)

mysql> insert into articuloxpedido values (2,1,5,65000);


Query OK, 1 row affected (0.04 sec)

mysql> insert into articuloxpedido values (3,2,10,55000);


Query OK, 1 row affected (0.05 sec)

mysql> insert into articuloxpedido values (3,3,12,45000);


Query OK, 1 row affected (0.07 sec)

mysql> insert into articuloxpedido values (4,1,20,65000);


Query OK, 1 row affected (0.09 sec)

mysql> select * from articuloxpedido;


+---------------+---------------+----------------+-------------------+
| id_ped_artped | id_art_artped | can_art_artped | val_ven_art_artpe |
+---------------+---------------+----------------+-------------------+
| 2 | 1 | 5 | 65000 |
| 4 | 1 | 20 | 65000 |
| 3 | 2 | 10 | 55000 |
| 1 | 3 | 5 | 40000 |
| 3 | 3 | 12 | 45000 |
| 1 | 4 | 12 | 55000 |
+---------------+---------------+----------------+-------------------+
6 rows in set (0.00 sec)

mysql> insert into compaia values ("800890890-2","seguros atlantida",1998,"carlos


lopez");
Query OK, 1 row affected (0.08 sec)

mysql> insert into compaia values ("899999999-1","seguradora roja",1991," luis


fernando rojas");
Query OK, 1 row affected (0.04 sec)

mysql> insert into compaia values ("899999999-5","seguros del estadio",2001,"maria


margarita Prez");
Query OK, 1 row affected (0.04 sec)

mysql> insert into cliente values ("63502718","maritza","rojas","calle 34 N 14-


45","santander","abril");
Query OK, 1 row affected (0.06 sec)

mysql> insert into cliente values ("13890234","roger","ariza","cra 30 n 13-


45","antioquia","junio");
Query OK, 1 row affected (0.03 sec)

mysql> insert into cliente values ("77191956","juan carlos","arenas","diagonal 23


n 12-34 apto 101","valle","marzo");
Query OK, 1 row affected (0.04 sec)

mysql> insert into cliente values ("1098765789","catalina","zapata","av. el


livertador n 30-14","cauca","marzo");
Query OK, 1 row affected (0.05 sec)

mysql> select * from cliente;


+------------+-------------+---------+--------------------------------+-----------
+-------------+
| id_cli | nom_cli | ape_cli | dir_cli | dep_cli |
mes_cum_cli |
+------------+-------------+---------+--------------------------------+-----------
+-------------+
| 1098765789 | catalina | zapata | av. el livertador n 30-14 | cauca |
marzo |
| 13890234 | roger | ariza | cra 30 n 13-45 | antioquia |
junio |
| 63502718 | maritza | rojas | calle 34 N 14- 45 | santander |
abril |
| 77191956 | juan carlos | arenas | diagonal 23 n 12-34 apto 101 | valle |
marzo |
+------------+-------------+---------+--------------------------------+-----------
+-------------+
4 rows in set (0.00 sec)

mysql> insert into articulo values (1,"redes cisco","ernesto


arigasello","alfaomega-rama",60000);
Query OK, 1 row affected (0.17 sec)

mysql> insert into articulo values (2,"facebook y twitter para adultos","veloso


claudio","alfaomega",52000);
Query OK, 1 row affected (0.07 sec)

mysql> insert into articulo values (3,"creacion de un portal con php y


mysql","jacobo pavon puerta", "alfaomega-rama",40000);
Query OK, 1 row affected (0.04 sec)

mysql> insert into articulo values (4,"administracion de sistemas


operativos","julio gomez lopez","alfaomega-rama",55000);
Query OK, 1 row affected (0.06 sec)

mysql> select * articulo;


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
'articulo' at line 1
mysql> select * from articulo;
+--------+---------------------------------------+---------------------
+----------------+----------+
| id_art | tit_art | aut_art | edi_art
| prec_art |
+--------+---------------------------------------+---------------------
+----------------+----------+
| 1 | redes cisco | ernesto arigasello | alfaomega-
rama | 60000 |
| 2 | facebook y twitter para adultos | veloso claudio | alfaomega
| 52000 |
| 3 | creacion de un portal con php y mysql | jacobo pavon puerta | alfaomega-
rama | 40000 |
| 4 | administracion de sistemas operativos | julio gomez lopez | alfaomega-
rama | 55000 |
+--------+---------------------------------------+---------------------
+----------------+----------+
4 rows in set (0.00 sec)
mysql> insert into compaia values ("800890890-2","seguros atlantida",1998,"carlos
lopez");
Query OK, 1 row affected (0.08 sec)
mysql> insert into compaia values ("899999999-1","seguradora roja",1991," luis
fernando rojas");
Query OK, 1 row affected (0.04 sec)

mysql> insert into compaia values ("899999999-5","seguros del estadio",2001,"maria


margarita Prez");
Query OK, 1 row affected (0.04 sec)

mysql> select * from ompaia;


ERROR 1146 (42S02): Table 'laboratoriosql.ompaia' doesn't exist
mysql> select *from compaia;
+-------------+---------------------+------------+------------------------+
| comnit | comnombre | comaofun | comreplegal |
+-------------+---------------------+------------+------------------------+
| 800890890-2 | seguros atlantida | 1998 | carlos lopez |
| 899999999-1 | seguradora roja | 1991 | luis fernando rojas |
| 899999999-5 | seguros del estadio | 2001 | maria margarita Prez |
+-------------+---------------------+------------+------------------------+
3 rows in set (0.00 sec)

mysql> drop table tiposautomotores;


Query OK, 0 rows affected (0.28 sec)

mysql> Insert into tiposautomotores values (1," automviles");


Query OK, 1 row affected (0.03 sec)

mysql> Insert into tiposautomotores values (2," camperos");


Query OK, 1 row affected (0.07 sec)

mysql> Insert into tiposautomotores values (3," camiones");


Query OK, 1 row affected (0.05 sec)

mysql> select* from tiposautomotores;


+---------+---------------+
| auttipo | autnombre |
+---------+---------------+
| 1 | automviles |
| 2 | camperos |
| 3 | camiones |
+---------+---------------+
3 rows in set (0.00 sec)
mysql> insert into automotores values ("fll420","Chevrolet
corsa",1,2003,5,1400,"Wywzzz16kk009d25");
Query OK, 1 row affected (0.07 sec)

mysql> insert into automotores values ("dkz820","renault


stepway",1,2008,5,1600,"Wywwzz15kk009d45");
Query OK, 1 row affected (0.06 sec)

mysql> insert into automotores values ("KJQ920","Kia


sportage",2,2009,7,2000,"Wywzzz157kk009d25");
Query OK, 1 row affected (0.07 sec)

mysql> select* from automotores;


+-----------+-----------------+----------+------------+------------------
+----------------+-------------------+
| autoplaca | automarca | autotipo | automodelo | autonumpasajeros |
autocilindraje | autonumchasis |
+-----------+-----------------+----------+------------+------------------
+----------------+-------------------+
| dkz820 | renault stepway | 1 | 2008 | 5 |
1600 | Wywwzz15kk009d45 |
| fll420 | Chevrolet corsa | 1 | 2003 | 5 |
1400 | Wywzzz16kk009d25 |
| KJQ920 | Kia sportage | 2 | 2009 | 7 |
2000 | Wywzzz157kk009d25 |
+-----------+-----------------+----------+------------+------------------
+----------------+-------------------+
3 rows in set (0.00 sec)
mysql> INSERT INTO aseguramientos (`asecodigo`, `asefechainicio`,
`asefechaexpiracion`, `asevalorasegurado`, `aseestado`, `asecosto`, `aseplaca`)
VALUES ('1', '2012/09/30', '2012/09/30', '30000000', 'vigente', '500000',
'FLL420');
Query OK, 1 row affected (0.10 sec)

mysql> INSERT INTO aseguramientos (`asecodigo`, `asefechainicio`,


`asefechaexpiracion`, `asevalorasegurado`, `aseestado`, `asecosto`, `aseplaca`)
VALUES ('2', '2012/09/27', '2012/09/27', '35000000', 'vigente', '600000',
'DKZ820');
Query OK, 1 row affected (0.07 sec)

mysql> INSERT INTO aseguramientos (`asecodigo`, `asefechainicio`,


`asefechaexpiracion`, `asevalorasegurado`, `aseestado`, `asecosto`, `aseplaca`)
VALUES ('3', '2012/09/28', '2012/09/28', '50000000', 'vencido', '800000',
'KLQ920');
Query OK, 1 row affected (0.05 sec)

mysql> select * from aseguramientos;


+-----------+----------------+--------------------+-------------------+-----------
+----------+----------+
| asecodigo | Asefechainicio | asefechaexpiracion | asevalorasegurado | aseestado |
asecosto | Aseplaca |
+-----------+----------------+--------------------+-------------------+-----------
+----------+----------+
| 1 | 2012-09-30 | 2012-09-30 | 30000000 | vigente |
500000 | FLL420 |
| 2 | 2012-09-27 | 2012-09-27 | 35000000 | vigente |
600000 | DKZ820 |
| 3 | 2012-09-28 | 2012-09-28 | 50000000 | vencido |
800000 | KLQ920 |
+-----------+----------------+--------------------+-------------------+-----------
+----------+----------+
3 rows in set (0.00 sec)

mysql> INSERT INTO incidentes (`incicodigo`, `incifecha`, `inciplaca`, `incilugar`,


`incicantheridos`, `inicicantfatalidades`, `incicantautosinvolucrados`) VALUES
('1', '2011/09/30', 'DKZ820', 'bucaramanga', '0', '0', '2');
ERROR 1054 (42S22): Unknown column 'inicicantfatalidades' in 'field list'
mysql> INSERT INTO incidentes VALUES ('1', '2011/09/30', 'DKZ820', 'bucaramanga',
'0', '0', '2');
Query OK, 1 row affected (0.06 sec)

mysql> INSERT INTO `incidentes VALUES ('2', '2011/09/27', 'FLL420', 'giron', '1',
'0', '1');
`> INSERT INTO `incidentes VALUES ('2', '2011/09/27', 'FLL420', 'giron', '1',
'0', '1');
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
'incidentes VALUES ('2', '2011/09/27', 'FLL420', 'giron', '1', '0', '1')' at line 1
mysql> INSERT INTO `incidentes VALUES ('2', '2011/09/27', 'FLL420', 'giron', '1',
'0', '1');
`> ;
`> INSERT INTO `incidentes VALUES ('2', '2011/09/27', 'FLL420', 'giron', '1',
'0', '1');
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
'incidentes VALUES ('2', '2011/09/27', 'FLL420', 'giron', '1', '0', '1')' at line 1
mysql> ^C
mysql> INSERT INTO incidentes VALUES ('2', '2011/09/27', 'FLL420', 'giron', '1',
'0', '1');
Query OK, 1 row affected (0.08 sec)

mysql> INSERT INTO incidentes VALUES ('3', '2011/09/28', 'FLL420', 'bucaramanga',


'1', '0', '2');
Query OK, 1 row affected (0.04 sec)

mysql> select *from incidentes;


+------------+------------+-----------+-------------+-----------------
+---------------------+---------------------------+
| incicodigo | incifecha | inciplaca | incilugar | incicantheridos |
incicantfatalidades | incicantautosinvolucrados |
+------------+------------+-----------+-------------+-----------------
+---------------------+---------------------------+
| 1 | 2011-09-30 | DKZ820 | bucaramanga | 0 |
0 | 2 |
| 2 | 2011-09-27 | FLL420 | giron | 1 |
0 | 1 |
| 3 | 2011-09-28 | FLL420 | bucaramanga | 1 |
0 | 2 |
+------------+------------+-----------+-------------+-----------------
+---------------------+---------------------------+
3 rows in set (0.00 sec)

Vous aimerez peut-être aussi