Skip to content

Instantly share code, notes, and snippets.

@ArCiGo
Last active May 19, 2019 21:40
Show Gist options
  • Save ArCiGo/fba8d5fe43b6472fd762ace74bc93140 to your computer and use it in GitHub Desktop.
Save ArCiGo/fba8d5fe43b6472fd762ace74bc93140 to your computer and use it in GitHub Desktop.
SELECT *
FROM Customer cus
WHERE cus.FirstName LIKE 'A%'; --All names that starts with A
GO
/** Output **/
Id FirstName LastName City Country Phone
----------- ---------------------------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- --------------------
2 Ana Trujillo México D.F. Mexico (5) 555-4729
3 Antonio Moreno México D.F. Mexico (5) 555-3932
19 Ann Devon London UK (171) 555-0297
21 Aria Cruz Sao Paulo Brazil (11) 555-9857
31 André Fonseca Campinas Brazil (11) 555-9482
41 Annette Roulet Toulouse France 61.77.61.10
52 Alexander Feuer Leipzig Germany 0342-023176
69 Alejandra Camino Madrid Spain (91) 745 6200
75 Art Braunschweiger Lander USA (307) 555-4680
81 Anabela Domingues Sao Paulo Brazil (11) 555-2167
SELECT *
FROM Customer cus
WHERE cus.FirstName LIKE '%A'; --All names that ends with A
GO
/** Output **/
Id FirstName LastName City Country Phone
----------- ---------------------------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- --------------------
1 Maria Anders Berlin Germany 030-0074321
2 Ana Trujillo México D.F. Mexico (5) 555-4729
5 Christina Berglund Luleå Sweden 0921-12 34 65
6 Hanna Moos Mannheim Germany 0621-08460
11 Victoria Ashworth London UK (171) 555-1212
21 Aria Cruz Sao Paulo Brazil (11) 555-9857
24 Maria Larsson Bräcke Sweden 0695-34 67 21
37 Patricia McKenna Cork Ireland 2967 542
62 Lúcia Carvalho Sao Paulo Brazil (11) 555-1189
65 Paula Wilson Albuquerque USA (505) 555-5939
69 Alejandra Camino Madrid Spain (91) 745 6200
81 Anabela Domingues Sao Paulo Brazil (11) 555-2167
86 Rita Müller Stuttgart Germany 0711-020361
88 Paula Parente Resende Brazil (14) 555-8122
SELECT *
FROM Customer cus
WHERE cus.FirstName LIKE '%A%'; --All names with that pattern
GO
/** Output **/
Id FirstName LastName City Country Phone
----------- ---------------------------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- --------------------
1 Maria Anders Berlin Germany 030-0074321
2 Ana Trujillo México D.F. Mexico (5) 555-4729
3 Antonio Moreno México D.F. Mexico (5) 555-3932
4 Thomas Hardy London UK (171) 555-7788
5 Christina Berglund Luleå Sweden 0921-12 34 65
6 Hanna Moos Mannheim Germany 0621-08460
8 Martín Sommer Madrid Spain (91) 555 22 82
9 Laurence Lebihan Marseille France 91.24.45.40
10 Elizabeth Lincoln Tsawassen Canada (604) 555-4729
11 Victoria Ashworth London UK (171) 555-1212
...
SELECT *
FROM Customer cus
WHERE cus.FirstName LIKE '%Peter%';
GO
/** Output **/
Id FirstName LastName City Country Phone
----------- ---------------------------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- --------------------
25 Peter Franken München Germany 089-0877310
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment