Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 164 Server version: 5.7.20 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> show databases;
+--------------------+ | Database | +--------------------+ | information_schema | | ciclistas | | mysql | | performance_schema | | sys | +--------------------+ 5 rows in set (0.02 sec)
+-----------------+ | Tables_in_rutas | +-----------------+ | Autobus | | Autobus_Ruta | | Chofer | | Ciudad | | Ruta | +-----------------+ 5 rows in set (0.00 sec)
mysql> describe ciudad;
+----------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+---------+----------------+ | idCiudad | int(11) | NO | PRI | NULL | auto_increment | | nombre | varchar(100) | NO | | NULL | | +----------+--------------+------+-----+---------+----------------+ 2 rows in set (0.09 sec)
mysql> insert into ciudad values(null,'Xalapa');
Query OK, 1 row affected (0.06 sec)
mysql> insert into ciudad values(null,'Xalapa');
Query OK, 1 row affected (0.02 sec) mysql> delete * from ciudad; 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 '* from ciudad' at line 1 mysql> delete from ciudad; Query OK, 2 rows affected (0.02 sec)
mysql> insert into ciudad values(null,'Xalapa');
Query OK, 1 row affected (0.00 sec)
mysql> insert into ciudad values(null,'Veracruz');
Query OK, 1 row affected (0.06 sec)
mysql> insert into ciudad values(null,'Coatepec');
Query OK, 1 row affected (0.00 sec)
mysql> insert into ciudad values(null,'Xico');
Query OK, 1 row affected (0.06 sec)
mysql> insert into ciudad values(null,'Banderilla');
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 'ciudad' at line 1 mysql> drop table ciudad; ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails mysql> mysql> insert chofer values(null,'Antonio Hernandez','2281111111','1960-08-20','Xalapa'); ERROR 1146 (42S02): Table 'rutas.cichofer' doesn't exist mysql> insert chofer values(null,'Antonio Hernandez','2281111111','1960- 08-20','Xalapa'); ERROR 1366 (HY000): Incorrect integer value: 'Xalapa' for column 'idCiudad' at row 1 mysql> insert chofer values(null,'Antonio Hernandez','2281111111','1960- 08-20',3); Query OK, 1 row affected (0.01 sec)
mysql> select * from chofer;
+----------+-------------------+------------+-----------------+----------+ | idChofer | nombre | telefono | fechaNacimiento | idCiudad | +----------+-------------------+------------+-----------------+----------+ | 1 | Antonio Hernandez | 2281111111 | 1960-08-20 | 3| +----------+-------------------+------------+-----------------+----------+ 1 row in set (0.00 sec)
mysql> describe chofer;
+-----------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------------+--------------+------+-----+---------+----------------+ | idChofer | int(11) | NO | PRI | NULL | auto_increment | | nombre | varchar(255) | NO | | NULL | | | telefono | varchar(10) | NO | | NULL | | | fechaNacimiento | date | YES | | NULL | | | idCiudad | int(11) | NO | MUL | NULL | | +-----------------+--------------+------+-----+---------+----------------+ 5 rows in set (0.01 sec)
+------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+-------------+------+-----+---------+-------+ | placa | varchar(9) | NO | PRI | NULL | | | modelo | varchar(50) | NO | | NULL | | | noAsientos | int(11) | NO | | NULL | | | idChofer | int(11) | YES | MUL | NULL | | +------------+-------------+------+-----+---------+-------+ 4 rows in set (0.47 sec)
mysql> insert into Autobus('A00000045','2000',25,2);
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 ''A00000045','2000',25,2)' at line 1 mysql> insert into Autobus('A00000045','2000',25,2); 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 ''A00000045','2000',25,2)' at line 1 mysql> insert into Autobus values('A00000045','2000',25,2); Query OK, 1 row affected (0.31 sec)
mysql> insert into Autobus values('A00000046','2004',25,5);
Query OK, 1 row affected (0.02 sec)
mysql> insert into Autobus values('B00000084','2006',28,1);
Query OK, 1 row affected (0.04 sec)
mysql> insert into Autobus values('B00000085','2006',30,3);
Query OK, 1 row affected (0.00 sec)
mysql> insert into Autobus values('C00000152','2012',38,6);
Query OK, 1 row affected (0.03 sec)
mysql> insert into Autobus values('C00000153','2013',38,4);
Query OK, 1 row affected (0.01 sec)
mysql> describe rutas;
ERROR 1146 (42S02): Table 'rutas.rutas' doesn't exist mysql> describe ruta; +-----------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------------+-------------+------+-----+---------+----------------+ | idRuta | int(11) | NO | PRI | NULL | auto_increment | | nombre | varchar(50) | NO | | NULL | | | idCiudadSalida | int(11) | NO | MUL | NULL | | | idCiudadLlegada | int(11) | NO | MUL | NULL | | +-----------------+-------------+------+-----+---------+----------------+ 4 rows in set (0.05 sec)
mysql> insert into ruta values(null,'Ruta 1','Xalapa','Banderilla');