0% found this document useful (0 votes)
6 views

TICS

The document shows the steps taken to connect to a MySQL database server and create databases, tables, and insert records. Specifically: 1) A connection is made to the MySQL server and the UNO database is created along with the ASESORES table. 2) Records are then inserted into the ASESORES table. 3) The ejercicio2 database is created along with the inquilinos table. Attempts are made to insert records into inquilinos and view existing records.

Uploaded by

Fernanda Leyte
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

TICS

The document shows the steps taken to connect to a MySQL database server and create databases, tables, and insert records. Specifically: 1) A connection is made to the MySQL server and the UNO database is created along with the ASESORES table. 2) Records are then inserted into the ASESORES table. 3) The ejercicio2 database is created along with the inquilinos table. Attempts are made to insert records into inquilinos and view existing records.

Uploaded by

Fernanda Leyte
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 6

Enter password: ****

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


Your MySQL connection id is 1
Server version: 5.1.34-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE DATABASE UNO;


Query OK, 1 row affected (0.01 sec)

mysql> SHOW DATABASES;


+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
| uno |
+--------------------+
4 rows in set (0.01 sec)

mysql> USE UNO;


Database changed
mysql> CREATE TABLE ASESORES (ID INT (11) PRIMARY KEY,CLAVE_ASESOR VARCHAR (45) NOT
NULL, AREAS VARCHAR (45) NOT NULL, NOMBRE VARCHAR (45) NOT NULL, APELLIDO_PATERNO
VARCHAR (45) NOT NULL, APELLIDO_MATERNO VARCHAR (45) NOT NULL);
Query OK, 0 rows affected (0.02 sec)

Enter password: ****


Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.34-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use uno;


Database changed
mysql> INSERT INTO ASESORES
VALUES(7,'M129','FINANCIERA','MELISSA','PEREZ','MORANTE');
Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO ASESORES VALUES(8,'M120','RR.HH','MARIA','GONZALES','ESPINOZA');


Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO ASESORES VALUES(9,'C131','VENTAS','CARLA','RIVERA','RODRIGUEZ');


Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO ASESORES


VALUES(10,'E132','FINANCIERA','ESTHER','AQUINO','SUAREZ');
Query OK, 1 row affected (0.01 sec)

mysql> SELECT * FROM ASESORES;


+----+--------------+------------+-----------+------------------+------------------
+
| ID | CLAVE_ASESOR | AREAS | NOMBRE | APELLIDO_PATERNO | APELLIDO_MATERNO
|
+----+--------------+------------+-----------+------------------+------------------
+
| 1 | J123 | FINANCIERA | JHON | SALAS | RODAS
|
| 2 | C124 | RR.HH | CARLOS | CONDORI | PEREZ
|
| 3 | D125 | VENTAS | DANIEL | MORA | CUEVA
|
| 4 | S126 | MARKETING | SEBASTIAN | REYES | PUERTA
|
| 5 | A127 | VENTAS | ANDRES | VALENCIA | ROJAS
|
| 6 | P128 | FINANCIERA | PEDRO | MIRANDA | BASURTO
|
| 7 | M129 | FINANCIERA | MELISSA | PEREZ | MORANTE
|
| 8 | M120 | RR.HH | MARIA | GONZALES | ESPINOZA
|
| 9 | C131 | VENTAS | CARLA | RIVERA | RODRIGUEZ
|
| 10 | E132 | FINANCIERA | ESTHER | AQUINO | SUAREZ
|
+----+--------------+------------+-----------+------------------+------------------
+
10 rows in set (0.00 sec)

mysql> CREATE DATABASE ejercicio2;


Query OK, 1 row affected (0.00 sec)

mysql> use ejercicio2;


Database changed
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| ejercicio2 |
| mysql |
| test |
| uno |
+--------------------+
5 rows in set (0.00 sec)

mysql> create table inquilinos (inquilinos int (5) primary key,id varchar(8) not
null, nombres varchar(45) not null, pat
erno varchar(45) not null, materno varchar(45) not null, telefono varchar(40) not
null, correo varchar(200) not null, de
uda decimal(6,2) not null, fecha_ingreso date not null );
Query OK, 0 rows affected (0.02 sec)

mysql> create table inquilinos (inquilinos int (5) primary key,id varchar(8) not
null, nombres varchar(45) not null, paterno varchar(45) not null, materno
varchar(45) not null, telefono varchar(40) not null, correo varchar(200) not null,
deuda decimal(6,2) not null, fecha_ingreso date not null );
ERROR 1050 (42S01): Table 'inquilinos' already exists
mysql> DESCRIBE inquilinos;
+---------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+-------+
| inquilinos | int(5) | NO | PRI | NULL | |
| id | varchar(8) | NO | | NULL | |
| nombres | varchar(45) | NO | | NULL | |
| paterno | varchar(45) | NO | | NULL | |
| materno | varchar(45) | NO | | NULL | |
| telefono | varchar(40) | NO | | NULL | |
| correo | varchar(200) | NO | | NULL | |
| deuda | decimal(6,2) | NO | | NULL | |
| fecha_ingreso | date | NO | | NULL | |
+---------------+--------------+------+-----+---------+-------+
9 rows in set (0.02 sec)

mysql> SHOW TABLES;


+----------------------+
| Tables_in_ejercicio2 |
+----------------------+
| inquilinos |
+----------------------+
1 row in set (0.00 sec)

mysql> DESCRIBE inquilinos


-> DESCRIBE inquilinos;
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 'DESCRIBE
inquilinos' at line 2
mysql> DESCRIBE inquilinos;
+---------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+-------+
| inquilinos | int(5) | NO | PRI | NULL | |
| id | varchar(8) | NO | | NULL | |
| nombres | varchar(45) | NO | | NULL | |
| paterno | varchar(45) | NO | | NULL | |
| materno | varchar(45) | NO | | NULL | |
| telefono | varchar(40) | NO | | NULL | |
| correo | varchar(200) | NO | | NULL | |
| deuda | decimal(6,2) | NO | | NULL | |
| fecha_ingreso | date | NO | | NULL | |
+---------------+--------------+------+-----+---------+-------+
9 rows in set (0.02 sec)

mysql> select * form inquilinos;


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 'form
inquilinos' at line 1
mysql> select * form inquilinos;
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 'form
inquilinos' at line 1
mysql> select * from inquilinos;
Empty set (0.00 sec)

mysql> select * from inquilinos;


Empty set (0.00 sec)

mysql> DESCRIBE inquilinos;


+---------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+-------+
| inquilinos | int(5) | NO | PRI | NULL | |
| id | varchar(8) | NO | | NULL | |
| nombres | varchar(45) | NO | | NULL | |
| paterno | varchar(45) | NO | | NULL | |
| materno | varchar(45) | NO | | NULL | |
| telefono | varchar(40) | NO | | NULL | |
| correo | varchar(200) | NO | | NULL | |
| deuda | decimal(6,2) | NO | | NULL | |
| fecha_ingreso | date | NO | | NULL | |
+---------------+--------------+------+-----+---------+-------+
9 rows in set (0.03 sec)

mysql> INSERT INTO inquilinos VALUES


(1,'24737466','JHON','SALAS','RODAS','6574376',[email protected]',34523,'2023-01-
15');
'>
'> INSERT INTO inquilinos VALUES
(1,'24737466','JHON','SALAS','RODAS','6574376','[email protected]',34523,'2023-01-
15');
'> INSERT INTO inquilinos VALUES
(1,'24737466','JHON','SALAS','RODAS','6574376','[email protected]',345.23,'2023-01-
15');
'> INSERT INTO inquilinos VALUES
(1,'24737466','JHON','SALAS','RODAS','6574376','[email protected]',345.23,'2023-01-
15');mysql
'>

mysql> DESCRIBE ASESORES;


+------------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------+-------------+------+-----+---------+-------+
| ID | int(11) | NO | PRI | NULL | |
| CLAVE_ASESOR | varchar(45) | NO | | NULL | |
| AREAS | varchar(45) | NO | | NULL | |
| NOMBRE | varchar(45) | NO | | NULL | |
| APELLIDO_PATERNO | varchar(45) | NO | | NULL | |
| APELLIDO_MATERNO | varchar(45) | NO | | NULL | |
+------------------+-------------+------+-----+---------+-------+
6 rows in set (0.02 sec)

mysql> SHOW TABLES;


+---------------+
| Tables_in_uno |
+---------------+
| asesores |
+---------------+
1 row in set (0.00 sec)

mysql> SHOW TABLES;


+---------------+
| Tables_in_uno |
+---------------+
| asesores |
+---------------+
1 row in set (0.00 sec)

mysql> INSERT INTO ASESORES VALUES(1,'J123', 'FINANCIERA', 'JHON', 'SALAS',


'RODAS');
Query OK, 1 row affected (0.02 sec)

mysql> INSERT INTO ASESORES VALUES(2, 'C124', 'RR.HH', 'CARLOS', 'CONDORI',


'PEREZ');
Query OK, 1 row affected (0.01 sec)

mysql> INSER INNTO ASESORES VALUES(3, 'D125', 'VENTAS', 'DANIEL', 'MORA', 'CUEVA');
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 'INSER
INNTO ASESORES VALUES(3, 'D125', 'VENTAS', 'DANIEL', 'MORA', 'CUEVA')' at line 1
mysql> INSERT INTO ASESORES VALUES(3, 'D125', 'VENTAS', 'DANIEL', 'MORA', 'CUEVA');
Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO ASESORES VALUES(4, 'S126', 'MARKETING', 'SEBASTIAN', 'REYES',


'PUERTA');
Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO ASESORES VALUES(5, 'A127', 'VENTAS', 'ANDRES', 'VALENCIA');


ERROR 1136 (21S01): Column count doesn't match value count at row 1
mysql> INSERT INTO ASESORES VALUES(5, 'A127', 'VENTAS', 'RICARDO', 'MARTINEZ');
ERROR 1136 (21S01): Column count doesn't match value count at row 1
mysql> INSERT INTO ASESORES VALUES(4, 'B122', 'VENTAS', 'ANDRES', 'VALENCIA',
'AVILA');
ERROR 1062 (23000): Duplicate entry '4' for key 'PRIMARY'
mysql>

Enter password: ****


Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.34-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use uno;


Database changed
mysql> INSERT INTO ASESORES
VALUES(7,'M129','FINANCIERA','MELISSA','PEREZ','MORANTE');
Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO ASESORES VALUES(8,'M120','RR.HH','MARIA','GONZALES','ESPINOZA');


Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO ASESORES VALUES(9,'C131','VENTAS','CARLA','RIVERA','RODRIGUEZ');


Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO ASESORES


VALUES(10,'E132','FINANCIERA','ESTHER','AQUINO','SUAREZ');
Query OK, 1 row affected (0.01 sec)

mysql> SELECT * FROM ASESORES;


+----+--------------+------------+-----------+------------------+------------------
+
| ID | CLAVE_ASESOR | AREAS | NOMBRE | APELLIDO_PATERNO | APELLIDO_MATERNO
|
+----+--------------+------------+-----------+------------------+------------------
+
| 1 | J123 | FINANCIERA | JHON | SALAS | RODAS
|
| 2 | C124 | RR.HH | CARLOS | CONDORI | PEREZ
|
| 3 | D125 | VENTAS | DANIEL | MORA | CUEVA
|
| 4 | S126 | MARKETING | SEBASTIAN | REYES | PUERTA
|
| 5 | A127 | VENTAS | ANDRES | VALENCIA | ROJAS
|
| 6 | P128 | FINANCIERA | PEDRO | MIRANDA | BASURTO
|
| 7 | M129 | FINANCIERA | MELISSA | PEREZ | MORANTE
|
| 8 | M120 | RR.HH | MARIA | GONZALES | ESPINOZA
|
| 9 | C131 | VENTAS | CARLA | RIVERA | RODRIGUEZ
|
| 10 | E132 | FINANCIERA | ESTHER | AQUINO | SUAREZ
|
+----+--------------+------------+-----------+------------------+------------------
+
10 rows in set (0.00 sec)

mysql>

You might also like