0% found this document useful (0 votes)
12 views6 pages

Segunda Parte Angel Villa Perez

The document outlines the process of setting up and using XAMPP with MariaDB on Windows, including commands for database management. It details attempts to create and manipulate databases and tables, highlighting various SQL syntax errors encountered during the process. The document also includes successful commands for creating tables and triggers, as well as issues with inserting data due to duplicate primary key entries.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views6 pages

Segunda Parte Angel Villa Perez

The document outlines the process of setting up and using XAMPP with MariaDB on Windows, including commands for database management. It details attempts to create and manipulate databases and tables, highlighting various SQL syntax errors encountered during the process. The document also includes successful commands for creating tables and triggers, as well as issues with inserting data due to duplicate primary key entries.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 6

Setting environment for using XAMPP for Windows.

angel@ASUS-A607 c:\xampp
# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 60
Server version: 10.4.32-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]> use deprtes_ortega2;


ERROR 1049 (42000): Unknown database 'deprtes_ortega2'
MariaDB [(none)]> show data bsae;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near 'data
bsae' at line 1
MariaDB [(none)]> show databsae;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near
'databsae' at line 1
MariaDB [(none)]> show databasae;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near
'databasae' at line 1
MariaDB [(none)]> show database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near
'database' at line 1
MariaDB [(none)]> show data base;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near 'data
base' at line 1
MariaDB [(none)]> show data bases;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near 'data
bases' at line 1
MariaDB [(none)]> show databases;
+---------------------------+
| Database |
+---------------------------+
| abcdinmobiliaria |
| deportes_morelia |
| deportes_morelia1 |
| deportes_ortega |
| deportes_ortega_2 |
| disparadores |
| ejemplo_textos |
| empleados_bd |
| empresa_morelia |
| escuelita |
| examen_parcial2 |
| examenparcial_1 |
| farmacia_morelia |
| farmacia_morelia_respaldo |
| information_schema |
| inmobiliaria_abcd |
| inmuebles |
| la_favorita |
| la_mexicana |
| libreria_moderna |
| mysql |
| parcial2_3a |
| parcial3_2a |
| performance_schema |
| phpmyadmin |
| practica1 |
| productos_lineas |
| proyectos_db |
| restriccion_tipo1 |
| restriccion_tipo2 |
| restriccion_tipo3 |
| test |
| tienda_morelia |
| tiendita |
| transacciones |
| videoteca |
+---------------------------+
36 rows in set (0.003 sec)

MariaDB [(none)]> use deprtes_ortega_2;


ERROR 1049 (42000): Unknown database 'deprtes_ortega_2'
MariaDB [(none)]> use deportes_ortega_2;
Database changed
MariaDB [deportes_ortega_2]> show tables;
+-----------------------------+
| Tables_in_deportes_ortega_2 |
+-----------------------------+
| categorias |
| clientes |
| facturas |
| productos |
| proveedores |
| ventas |
+-----------------------------+
6 rows in set (0.003 sec)

MariaDB [deportes_ortega_2]> create table clientes_copia(id_cliente int primary key


auto_increment, nombre char(50), direccion char(60), telefono char(60));
Query OK, 0 rows affected (0.029 sec)

MariaDB [deportes_ortega_2]> delimiter //


MariaDB [deportes_ortega_2]> create trigger trigger_insert_clientes
-> -> after insert on clientes
-> -> for each row
-> -> begin
-> -> insert into clientes_copia(id_cliente, nombre, direccion, telefono)
-> -> values(new.id_cliente, new.nombre, new.direccion, new.telefono);
-> -> end;
-> //
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near '->
after insert on clientes
-> for each row
-> begin
-> insert in...' at line 2
MariaDB [deportes_ortega_2]> create trigger trigger_insert_clientes
-> after insert into on clientes
-> for each row
-> begin
-> insert into clientes_copia(id_cliente,nombre,direccion,telefono)
-> values(new.id_cliente, new.nombre, new.direccion, new.telefono);
-> end;
-> end //
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near 'into
on clientes
for each row
begin
insert into clientes_copia(id_cliente,nom...' at line 2
MariaDB [deportes_ortega_2]> desc clientes;
-> desc clientes//
+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| ID_CLIENTE | int(11) | NO | PRI | NULL | |
| NOMBRE | varchar(255) | YES | | NULL | |
| DIRECCION | varchar(255) | YES | | NULL | |
| TELEFONO | varchar(50) | YES | | NULL | |
+------------+--------------+------+-----+---------+-------+
4 rows in set (0.023 sec)

+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| ID_CLIENTE | int(11) | NO | PRI | NULL | |
| NOMBRE | varchar(255) | YES | | NULL | |
| DIRECCION | varchar(255) | YES | | NULL | |
| TELEFONO | varchar(50) | YES | | NULL | |
+------------+--------------+------+-----+---------+-------+
4 rows in set (0.034 sec)

MariaDB [deportes_ortega_2]> create trigger trigger_insert_clientes


-> -> after insert on clientes
-> for each row
-> begin
-> insert into clientes_copia(id_cliente,nombre,direccion,telefono)
-> values(new.ID_CLIENTE, new.NOMBRE, new.DIRECCION, new.TELEFONO);
-> end;
-> end //
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near '->
after insert on clientes
for each row
begin
insert into clientes_copia(id_...' at line 2
MariaDB [deportes_ortega_2]> create trigger trigger_insert_clientes
-> -> after insert on clientes
-> -> for each row
-> begin
-> insert into clientes_copia(id_cliente,nombre,direccion,telefono)
-> values(new.ID_CLIENTE, new.NOMBRE, new.DIRECCION, new.TELEFONO);
-> end;
-> //
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near '->
after insert on clientes
-> for each row
begin
insert into clientes_co...' at line 2
MariaDB [deportes_ortega_2]> DROP TABLE clientes_copia;
-> //
Query OK, 0 rows affected (0.013 sec)

MariaDB [deportes_ortega_2]> create table clientes_copia(ID_CLIENTE int primary key


auto_increment, NOMBRE char(50), DIRECCION char(60), TELEFONO char(60));
-> //
Query OK, 0 rows affected (0.019 sec)

MariaDB [deportes_ortega_2]> create trigger trigger_insert_clientes


-> after insert on clientes
-> for each row
-> begin
-> insert into clientes_copia(ID_CLIENTE, NOMBRE, DIRECCION, TELEFONO)
-> values(new.ID_CLIENTE, new.NOMBRE, new.DIRECCION, new.TELEFONO);
-> end;
-> //
Query OK, 0 rows affected (0.015 sec)

MariaDB [deportes_ortega_2]> insert into clientes (NOMBRE, DIRECCION, TELEFONO)


values
-> -> ("Diego Go", "Prados Verdes", "4436567876"),
-> -> ("Robert Lewandowsky", "Villas del Pedregal", "4436554433"),
-> -> ("Kilyan Mbappe", "Obrera", "4431234342"),
-> -> ("Cristiano Ronaldo", "Altozano", "4435656072"),
-> -> ("Vinicius Jr", "Centro", "4433459988");
-> //
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near '->
("Diego Go", "Prados Verdes", "4436567876"),
-> ("Robert Lewandowsky",...' at line 2
MariaDB [deportes_ortega_2]> delimiter ;
MariaDB [deportes_ortega_2]> insert into clientes (NOMBRE, DIRECCION, TELEFONO)
values
-> -> ("Diego Go", "Prados Verdes", "4436567876"),
-> -> ("Robert Lewandowsky", "Villas del Pedregal", "4436554433"),
-> -> ("Kilyan Mbappe", "Obrera", "4431234342"),
-> -> ("Cristiano Ronaldo", "Altozano", "4435656072"),
-> -> ("Vinicius Jr", "Centro", "4433459988");
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near '->
("Diego Go", "Prados Verdes", "4436567876"),
-> ("Robert Lewandowsky",...' at line 2
MariaDB [deportes_ortega_2]> insert into clientes (NOMBRE, DIRECCION, TELEFONO)
values ("Diego Go", "Prados Verdes", "4436567876"), ("Robert Lewandowsky", "Villas
del Pedregal", "4436554433"), ("Kilyan Mbappe", "Obrera", "4431234342"),("Cristiano
Ronaldo", "Altozano", "4435656072"),("Vinicius Jr", "Centro", "4433459988");
ERROR 1062 (23000): Duplicate entry '0' for key 'PRIMARY'
MariaDB [deportes_ortega_2]> insert into clientes (NOMBRE, DIRECCION, TELEFONO)
values ("Diego", "Prados Verdes", "4436567876"), ("Roberto Lewandowsky", "Villas
del Pedregal", "4436554433"), ("Kilyan Mbappe", "Obrera", "4431234342"),("Cristiano
Ronaldo", "Altozano", "4435656072"),("Vinicius Jr", "Centro", "4433459988");
ERROR 1062 (23000): Duplicate entry '0' for key 'PRIMARY'
MariaDB [deportes_ortega_2]> INSERT INTO clientes (nombre, direccion, telefono)
VALUES
-> ("Diego Go", "Prados Verdes", "4436567876"),
-> ("Robert Lewandowsky", "Villas del Pedregal", "4436554433"),
-> ("Kilyan Mbappe", "Obrera", "4431234342"),
-> ("Cristiano Ronaldo", "Altozano", "4435656072"),
-> ("Vinicius Jr", "Centro", "4433459988");
ERROR 1062 (23000): Duplicate entry '0' for key 'PRIMARY'
MariaDB [deportes_ortega_2]> INSERT INTO clientes (nombre, direccion, telefono)
VALUES
-> ("Carlos Martínez", "Avenida Central 123", "4439876543"),
-> ("Lucía Fernández", "Calle de la Paz 456", "4436549876"),
-> ("Antonio Gómez", "Avenida Juárez 789", "4431235678"),
-> ("María López", "Calle El Sol 321", "4438765432"),
-> ("Javier Pérez", "Avenida Hidalgo 654", "4432345678");
ERROR 1062 (23000): Duplicate entry '0' for key 'PRIMARY'
MariaDB [deportes_ortega_2]> DELETE FROM clientes WHERE id_cliente = 0;
Query OK, 0 rows affected (0.010 sec)

MariaDB [deportes_ortega_2]> ALTER TABLE clientes AUTO_INCREMENT = 1;


Query OK, 0 rows affected (0.013 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [deportes_ortega_2]> insert into clientes (NOMBRE, DIRECCION, TELEFONO)


values ("Diego", "Prados Verdes", "4436567876"), ("Roberto Lewandowsky", "Villas
del Pedregal", "4436554433"), ("Kilyan Mbappe", "Obrera", "4431234342"),("Cristiano
Ronaldo", "Altozano", "4435656072"),("Vinicius Jr", "Centro", "4433459988");
ERROR 1062 (23000): Duplicate entry '0' for key 'PRIMARY'
MariaDB [deportes_ortega_2]> INSERT INTO clientes (nombre, direccion, telefono)
VALUES
-> ("Carlos Martínez", "Avenida Central 123", "4439876543"),
-> ("Lucía Fernández", "Calle de la Paz 456", "4436549876"),
-> ("Antonio Gómez", "Avenida Juárez 789", "4431235678"),
-> ("María López", "Calle El Sol 321", "4438765432"),
-> ("Javier Pérez", "Avenida Hidalgo 654", "4432345678");
ERROR 1062 (23000): Duplicate entry '0' for key 'PRIMARY'
MariaDB [deportes_ortega_2]> desc clientes;
+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| ID_CLIENTE | int(11) | NO | PRI | NULL | |
| NOMBRE | varchar(255) | YES | | NULL | |
| DIRECCION | varchar(255) | YES | | NULL | |
| TELEFONO | varchar(50) | YES | | NULL | |
+------------+--------------+------+-----+---------+-------+
4 rows in set (0.008 sec)

MariaDB [deportes_ortega_2]> desc proveedores;


+--------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+-------+
| ID_PROVEEDOR | int(11) | NO | PRI | NULL | |
| NOMBRE | varchar(255) | YES | | NULL | |
| DIRECCION | varchar(255) | YES | | NULL | |
| TELEFONO | varchar(50) | YES | | NULL | |
+--------------+--------------+------+-----+---------+-------+
4 rows in set (0.011 sec)

MariaDB [deportes_ortega_2]> ALTER TABLE clientes MODIFY COLUMN ID_CLIENTE INT(11)


NOT NULL AUTO_INCREMENT;
Query OK, 0 rows affected (0.072 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [deportes_ortega_2]> ALTER TABLE clientes MODIFY COLUMN ID_PROVEEDOR


INT(11) NOT NULL AUTO_INCREMENT;
ERROR 1054 (42S22): Unknown column 'ID_PROVEEDOR' in 'clientes'
MariaDB [deportes_ortega_2]> ALTER TABLE proveedores MODIFY COLUMN ID_PROVEEDOR
INT(11) NOT NULL AUTO_INCREMENT;
Query OK, 0 rows affected (0.065 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [deportes_ortega_2]> insert into clientes (NOMBRE, DIRECCION, TELEFONO)


values ("Diego", "Prados Verdes", "4436567876"), ("Roberto Lewandowsky", "Villas
del Pedregal", "4436554433"), ("Kilyan Mbappe", "Obrera", "4431234342"),("Cristiano
Ronaldo", "Altozano", "4435656072"),("Vinicius Jr", "Centro", "4433459988");
Query OK, 5 rows affected (0.007 sec)
Records: 5 Duplicates: 0 Warnings: 0

MariaDB [deportes_ortega_2]> INSERT INTO proveedores (NOMBRE, DIRECCION, TELEFONO)


VALUES
-> ("Nike", "Ciudad de México", "5566778899"),
-> ("Adidas", "Monterrey", "5543567765"),
-> ("Puma", "Guadalajara", "4432332233"),
-> ("New Balance", "Querétaro", "4431234562"),
-> ("Pirma", "Tijuana", "5523432451");
Query OK, 5 rows affected, 2 warnings (0.007 sec)
Records: 5 Duplicates: 0 Warnings: 2

MariaDB [deportes_ortega_2]> desc categorias;


+--------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+-------+
| ID_CATEGORIA | int(11) | NO | PRI | NULL | |
| DESCRIPCION | varchar(255) | YES | | NULL | |
+--------------+--------------+------+-----+---------+-------+
2 rows in set (0.019 sec)

MariaDB [deportes_ortega_2]> INSERT INTO proveedores (NOMBRE, DIRECCION, TELEFONO)


VALUES
-> ("Reebok", "Ciudad Juárez", "5566889900"),
-> ("Under Armour", "Culiacán", "4422334455"),
-> ("Fila", "Mérida", "4436789101"),
-> ("K-Swiss", "Cancún", "5522346789");
Query OK, 4 rows affected, 4 warnings (0.006 sec)
Records: 4 Duplicates: 0 Warnings: 4

You might also like