Functies voor het bewerken van data in SQL Server
Ana Voicu
Data Engineer
Onthoud: om twee waarden te vergelijken, moeten ze van hetzelfde type zijn.
Anders:
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 |
| ... | ... | ... |
Functies voor het bewerken van data in SQL Server