Fonctions pour manipuler les données dans SQL Server
Ana Voicu
Data Engineer
À retenir : pour comparer deux valeurs, elles doivent être du même type.
Sinon :
SELECT
company
bean_type,
cocoa_percent
FROM ratings;
SELECT
company
bean_type,
cocoa_percent
FROM ratings
WHERE cocoa_percent > 0.5;
| company | bean_type | cocoa_percent |
|---------|------------|---------------|
| Amedei | Blend | 0.7000 |
| Bonnat | Trinitario | 0.7500 |
| ... | ... | ... |
SELECT
company
bean_type,
cocoa_percent
FROM ratings
WHERE cocoa_percent > -2;
| company | bean_type | cocoa_percent |
|---------|------------|---------------|
| Amedei | Blend | 0.7000 |
| Bonnat | Trinitario | 0.7500 |
| ... | ... | ... |
SELECT
company
bean_type,
cocoa_percent
FROM ratings
WHERE cocoa_percent > GETDATE();
| company | bean_type | cocoa_percent |
|---------|------------|---------------|
| ... | ... | ... |
SELECT
company
bean_type,
cocoa_percent
FROM ratings
WHERE cocoa_percent > 'A';
| result |
|------------------------------------------------|
| Error converting data type varchar to numeric. |
SELECT
company
bean_type,
cocoa_percent
FROM ratings
WHERE cocoa_percent > '0.5';
| company | bean_type | cocoa_percent |
|---------|------------|---------------|
| Amedei | Blend | 0.7000 |
| Bonnat | Trinitario | 0.7500 |
| ... | ... | ... |
Fonctions pour manipuler les données dans SQL Server