Server version: 10.7.4-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)]> show databases;
+--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | | test | +--------------------+ 5 rows in set (0.002 sec)
MariaDB [(none)]> use test;
Database changed MariaDB [test]> create table personal; ERROR 1113 (42000): A table must have at least 1 column MariaDB [test]> create table personal; ERROR 1113 (42000): A table must have at least 1 column MariaDB [test]> create table personal(id int not null primary key auto_increment,nombre varchar(50) not null, apellido varchar(50) not null, direccion varchar(250), telefono varchar(9),correo varchar(50) not null, f_crea datetime not null default current_timestamp,activo bit not null default 1, jefe int not null); Query OK, 0 rows affected (0.084 sec)
MariaDB [test]> desc personal;
+-----------+--------------+------+-----+---------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------+--------------+------+-----+---------------------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | nombre | varchar(50) | NO | | NULL | | | apellido | varchar(50) | NO | | NULL | | | direccion | varchar(250) | YES | | NULL | | | telefono | varchar(9) | YES | | NULL | | | correo | varchar(50) | NO | | NULL | | | f_crea | datetime | NO | | current_timestamp() | | | activo | bit(1) | NO | | b'1' | | | jefe | int(11) | NO | | NULL | | +-----------+--------------+------+-----+---------------------+----------------+ 9 rows in set (0.063 sec)
MariaDB [test]> insert into personal(
-> ; 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 '' at line 1 MariaDB [test]> insert into personal(nombre,apellido,direccion, telefono,correo, f_crea, jefe) -> values -> ('Abel','Rojas',); 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 ')' at line 3 MariaDB [test]> insert into personal(nombre,apellido,direccion, telefono,correo, jefe) -> values -> ('Abel','Rojas','Las fuentes','65872354','Abel.Rojas@mimail.net'), -> ('Ana','Morango','Villa Juan','64781121',''), -> ; 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 '' at line 4 MariaDB [test]> insert into personal(nombre,apellido,direccion, telefono,correo, jefe) -> values -> ('Abel','Rojas','Las fuentes','65872354','Abel.Rojas@mimail.net','0'), -> ('Ana','Morango','Villa Juan','64781121','Ana.Morango@mimail.net','1'), -> ('Juan','Paez','Casa Palmera','63325873','Juan.Paez@mimail.net','1'), -> ('Marcos','Villar','Alto Cielo','69958741','Marcos.Villar@mimail.net','1'), -> ('Ester','Niza','Valle Sol','63632588','Ester.Niza@mimail.net','2'), -> ('Karen','Yee','San Soriano','61120025','Karen.Yee@mimail.net','2'), -> ('Ashley','Castillo','Los uvitos','60852322','Ashley.Castillo@mimail.net','3'), -> ('Marta','Him','Ninguna Parte','60608744','Marta.Him@mimail.net','3'), -> ('Lucas','Mora','Residencial Estrella','62201477','Lucas.Mora@mimail.net','4'), -> ('Jair','Tapia','Bajo Flor','63003030','Jair.Tapia@mimail.net','5'); Query OK, 10 rows affected (0.038 sec) Records: 10 Duplicates: 0 Warnings: 0
MariaDB [test]> select * from personal;
+----+--------+----------+----------------------+---------- +----------------------------+---------------------+--------+------+ | id | nombre | apellido | direccion | telefono | correo | f_crea | activo | jefe | +----+--------+----------+----------------------+---------- +----------------------------+---------------------+--------+------+ | 1 | Abel | Rojas | Las fuentes | 65872354 | Abel.Rojas@mimail.net | 2022-08-04 18:40:24 | ☺ | 0 | | 2 | Ana | Morango | Villa Juan | 64781121 | Ana.Morango@mimail.net | 2022-08-04 18:40:24 | ☺ | 1 | | 3 | Juan | Paez | Casa Palmera | 63325873 | Juan.Paez@mimail.net | 2022-08-04 18:40:24 | ☺ | 1 | | 4 | Marcos | Villar | Alto Cielo | 69958741 | Marcos.Villar@mimail.net | 2022-08-04 18:40:24 | ☺ | 1 | | 5 | Ester | Niza | Valle Sol | 63632588 | Ester.Niza@mimail.net | 2022-08-04 18:40:24 | ☺ | 2 | | 6 | Karen | Yee | San Soriano | 61120025 | Karen.Yee@mimail.net | 2022-08-04 18:40:24 | ☺ | 2 | | 7 | Ashley | Castillo | Los uvitos | 60852322 | Ashley.Castillo@mimail.net | 2022-08-04 18:40:24 | ☺ | 3 | | 8 | Marta | Him | Ninguna Parte | 60608744 | Marta.Him@mimail.net | 2022-08-04 18:40:24 | ☺ | 3 | | 9 | Lucas | Mora | Residencial Estrella | 62201477 | Lucas.Mora@mimail.net | 2022-08-04 18:40:24 | ☺ | 4 | | 10 | Jair | Tapia | Bajo Flor | 63003030 | Jair.Tapia@mimail.net | 2022-08-04 18:40:24 | ☺ | 5 | +----+--------+----------+----------------------+---------- +----------------------------+---------------------+--------+------+ 10 rows in set (0.007 sec) MariaDB [test]> select p.id, concat_ws(' ',p.nomre,p.apellido) as funcionario, concat_ws(' ',j.nombre,j.apellido) as jefe, j.jefe as nivel from personal as p -> inner join personal as j on p.jefe=j.id -> order by j.id; ERROR 1054 (42S22): Unknown column 'p.nomre' in 'field list' MariaDB [test]> select p.id, concat_ws(' ',p.nombre,p.apellido) as funcionario, concat_ws(' ',j.nombre,j.apellido) as jefe, j.jefe as nivel from personal as p -> inner join personal as j on p.jefe=j.id -> order by j.id; +----+-----------------+---------------+-------+ | id | funcionario | jefe | nivel | +----+-----------------+---------------+-------+ | 2 | Ana Morango | Abel Rojas | 0 | | 3 | Juan Paez | Abel Rojas | 0 | | 4 | Marcos Villar | Abel Rojas | 0 | | 6 | Karen Yee | Ana Morango | 1 | | 5 | Ester Niza | Ana Morango | 1 | | 7 | Ashley Castillo | Juan Paez | 1 | | 8 | Marta Him | Juan Paez | 1 | | 9 | Lucas Mora | Marcos Villar | 1 | | 10 | Jair Tapia | Ester Niza | 2 | +----+-----------------+---------------+-------+ 9 rows in set (0.009 sec)