SQL : Comprendre les rêquetes LEFT JOIN via un exemple

Voici un petit exemple, on va faire une base de donnée sous Postgresql :

$ createdb CLASSE
$ psql -d CLASSE
psql (14.11 (Ubuntu 14.11-0ubuntu0.22.04.1), server 10.15 (Ubuntu 10.15-0ubuntu0.18.04.1))
Type "help" for help.
CLASSE=> create table classe (Prenom varchar(50) primary key, classe int);
CREATE TABLE
CLASSE=> create table math (Prenom varchar(50) primary key, note float);
CREATE TABLE
CLASSE=> create table anglais (Prenom varchar(50) primary key, note float);
CREATE TABLE
CLASSE=> create table espagnol (Prenom varchar(50) primary key, note float);
CREATE TABLE
CLASSE=> insert into classe (Prenom, classe) values ('Riri',1);
INSERT 0 1
CLASSE=> insert into classe (Prenom, classe) values ('Fifi',1);
INSERT 0 1
CLASSE=> insert into classe (Prenom, classe) values ('Loulou',1);
INSERT 0 1
CLASSE=> insert into classe (Prenom, classe) values ('Paul',2);
INSERT 0 1
CLASSE=> insert into classe (Prenom, classe) values ('Pierre',2);
INSERT 0 1
CLASSE=> insert into classe (Prenom, classe) values ('Jacques',2);
INSERT 0 1
CLASSE=> insert into math (Prenom, note) values ('Riri',10);
INSERT 0 1
CLASSE=> insert into math (Prenom, note) values ('Fifi',11);
INSERT 0 1
CLASSE=> insert into math (Prenom, note) values ('Loulou',12);
INSERT 0 1
CLASSE=> insert into math (Prenom, note) values ('Paul',13);
INSERT 0 1
CLASSE=> insert into math (Prenom, note) values ('Pierre',14);
INSERT 0 1
CLASSE=> insert into math (Prenom, note) values ('Jacques',15);
INSERT 0 1
CLASSE=> insert into anglais (Prenom, note) values ('Riri',11);
INSERT 0 1
CLASSE=> insert into anglais (Prenom, note) values ('Fifi',12);
INSERT 0 1
CLASSE=> insert into espagnol (Prenom, note) values ('Loulou',13);
INSERT 0 1
CLASSE=> insert into espagnol (Prenom, note) values ('Paul',14);
INSERT 0 1
CLASSE=> insert into espagnol (Prenom, note) values ('Pierre',15);
INSERT 0 1
CLASSE=> insert into anglais (Prenom, note) values ('Jacques',16);
INSERT 0 1

On a donc 2 classes de 3 élèves, et dans les classes tous le monde à math mais les langues sont mélangés.

Sans jointure on n’a rien :

CLASSE=> select c.Prenom,m.note as Math,a.note as Anglais, e.note as Espagnol   
from classe c, math m, anglais a, espagnol e 
where c.Prenom = a.Prenom and c.Prenom = m.Prenom and c.Prenom = e.Prenom and c.classe = 1;

 prenom | math | anglais | espagnol 
--------+------+---------+----------
(0 rows)

Ce qui est normal car personne ne fait Anglais & Espagnol.

Avec une jointure je vais ajouter les données si elles sont disponibles :

CLASSE=> select c.Prenom,m.note as Math,a.note as Anglais, e.note as Espagnol 
from classe c 
     LEFT JOIN math m ON c.Prenom = m.Prenom  
     LEFT JOIN anglais a ON c.Prenom = a.Prenom 
     LEFT JOIN espagnol e ON c.Prenom = e.Prenom  
where c.classe = 1;
 prenom | math | anglais | espagnol 
--------+------+---------+----------
 Loulou |   12 |         |       13
 Riri   |   10 |      11 |         
 Fifi   |   11 |      12 |         
(3 rows)

 

Mise à jours de Grafana sous Ubuntu

J’ai une version Grafana : v6.7.4 (June 3, 2020) sous Ubuntu. J’ai donc fait une mise à jours vers la version v10.3.3 .

En fait le « apt upgrade » ne fonctionnait pas.

 Le fichier configuré « main/binary-i386/Packages » ne sera pas pris en compte 
car le dépôt « https://apt.grafana.com stable InRelease » 
ne prend pas en charge l'architecture « i386 »

J’ai donc fait :

# apt-get install -y adduser libfontconfig1 musl
# wget https://dl.grafana.com/enterprise/release/grafana-enterprise_10.3.3_amd64.deb
# cp /var/lib/grafana/grafana.db .
# apt-get remove grafana
# sudo snap remove grafana
# sudo dpkg -i grafana-enterprise_10.3.3_amd64.deb
# sudo /bin/systemctl daemon-reload
# sudo /bin/systemctl enable grafana-server
# updatedb
# cp /var/lib/grafana/grafana.db /var/lib/grafana/grafana.db.backup
# cp /root/grafana.db /var/lib/grafana/grafana.db

Je suis passé du port 3000 au port 3001.
Le backup de la configuration ( grafana.db )  n’a pas fonctionné …

Misère.

Migration de VMWare ESXi 6.7 à Proxmox 8.1.3

En passant

J’ai donc fait la migration de mon serveur ESXi 6.7 vers un serveur Proxmox 8.1.3. Je sais pas pourquoi je l’ai pas fait avant. Maintenant je peux faire des backups, des snapshots, …

Les VM que j’ai migré :

  • Debian 12
  • Ubuntu 22
  • Oracle Linux 7.9
  • Oracle Linux 8.9
  • Oracle Linux 9.4
  • Windows 10

J’ai eu aucun problème. Je conseille vivement le passage sous Proxmox qui me semble la meilleure alternative à VMWare.

TUXEDO : Tuxedo Control Center 2.1.1 : Big issue

Now I have always high CPU load (process tccd) and fan at 100% … very good release !


And also impossible to put « Powersave extreme » or « Quiet » … the laptop stop after too hot.

My OS : 22.04.3 LTS (Jammy Jellyfish) .

Logs :

In loops :

$ grep "tccd" /var/log/syslog | tail -f
Dec 20 12:06:47 TUXEDO-Polaris-Intel-Gen3-TGL tccd[1152]: Authorization required, but no authorization protocol specified
Dec 20 12:06:47 TUXEDO-Polaris-Intel-Gen3-TGL tccd[1152]: Can't open display :1
Dec 20 12:06:47 TUXEDO-Polaris-Intel-Gen3-TGL tccd[1152]: Failed executing onWork() => Error: Command failed: export XAUTHORITY=/home/arias/.Xauthority && xrandr -q -display :1 --current
Dec 20 12:06:47 TUXEDO-Polaris-Intel-Gen3-TGL tccd[1152]: Authorization required, but no authorization protocol specified
Dec 20 12:06:47 TUXEDO-Polaris-Intel-Gen3-TGL tccd[1152]: Can't open display :1
Dec 20 12:06:50 TUXEDO-Polaris-Intel-Gen3-TGL tccd[1152]: Authorization required, but no authorization protocol specified
Dec 20 12:06:50 TUXEDO-Polaris-Intel-Gen3-TGL tccd[1152]: Can't open display :1
Dec 20 12:06:50 TUXEDO-Polaris-Intel-Gen3-TGL tccd[1152]: Failed executing onWork() => Error: Command failed: export XAUTHORITY=/home/arias/.Xauthority && xrandr -q -display :1 --current
Dec 20 12:06:50 TUXEDO-Polaris-Intel-Gen3-TGL tccd[1152]: Authorization required, but no authorization protocol specified
Dec 20 12:06:50 TUXEDO-Polaris-Intel-Gen3-TGL tccd[1152]: Can't open display :1

And also :

Dec 20 12:26:48 TUXEDO-Polaris-Intel-Gen3-TGL dbus-daemon[1100]: [system] The maximum number of pending replies for ":1.153" (uid=1000 pid=6362 comm="/opt/tuxedo-control-center/tuxedo-control-center -" label="unconfined") has been reached (max_replies_per_connection=1024)

Sensors :

# sensors
iwlwifi_1-virtual-0
Adapter: Virtual device
temp1:        +53.0°C  
 
nvme-pci-2f00
Adapter: PCI adapter
Composite:    +47.9°C  (low  = -273.1°C, high = +81.8°C)
                       (crit = +84.8°C)
Sensor 1:     +47.9°C  (low  = -273.1°C, high = +65261.8°C)
Sensor 2:     +38.9°C  (low  = -273.1°C, high = +65261.8°C)
 
BAT0-acpi-0
Adapter: ACPI interface
in0:          16.42 V  
curr1:         0.00 A  
 
coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +82.0°C  (high = +100.0°C, crit = +100.0°C)
Core 0:        +50.0°C  (high = +100.0°C, crit = +100.0°C)
Core 1:        +68.0°C  (high = +100.0°C, crit = +100.0°C)
Core 2:        +49.0°C  (high = +100.0°C, crit = +100.0°C)
Core 3:        +82.0°C  (high = +100.0°C, crit = +100.0°C)
Core 4:        +49.0°C  (high = +100.0°C, crit = +100.0°C)
Core 5:        +59.0°C  (high = +100.0°C, crit = +100.0°C)
Core 6:        +49.0°C  (high = +100.0°C, crit = +100.0°C)
Core 7:        +49.0°C  (high = +100.0°C, crit = +100.0°C)
 
ucsi_source_psy_USBC000:001-isa-0000
Adapter: ISA adapter
in0:           0.00 V  (min =  +0.00 V, max =  +0.00 V)
curr1:         0.00 A  (max =  +0.00 A)
 
nvme-pci-0200
Adapter: PCI adapter
Composite:    +38.9°C  (low  = -273.1°C, high = +81.8°C)
                       (crit = +84.8°C)
Sensor 1:     +38.9°C  (low  = -273.1°C, high = +65261.8°C)
Sensor 2:     +42.9°C  (low  = -273.1°C, high = +65261.8°C)
 
acpitz-acpi-0
Adapter: ACPI interface
temp1:        +86.0°C  (crit = +100.0°C)
temp2:        +86.0°C  (crit = +119.0°C)