Monday, 29 August 2016

The UnderScore Sign




Nice! Now, sometimes we may not remember just one letter of a specific name. Imagine we want to find a girl whose name is... Catherine? Katherine?

SELECT *
FROM user
WHERE name LIKE '_atherine';

The underscore sign (_) replaces exactly one character. Whether it's Catherine or Katherine - the expression will return a row.

Syntax
SELECT * FROM tavle_name WHERE column_name LIKE '_alue';
SELECT * FROM tavle_name WHERE column_name LIKE 'va_ue';
SELECT * FROM tavle_name WHERE column_name LIKE 'valu_'; 






Exercise

Select all columns for cars whose brand is 'Volk_wagen' (the underscore replaces one unknown characters).


VIN
BRAND
MODEL
PRICE
PRODUCTION_YEAR
KLATF08Y1VB363636
Volkswagen
Golf
3270.00
1992
1M8GDM9AXKP042788
Volkswagen
Golf
13000.00
2010
1HGCM82633A004352
Volkswagen
Jetta
6420.00
2003
 


No comments:

Post a Comment