SQL Statement 2 Flashcards

1
Q

Select all customers that starts with the letter “a”;

A

SELECT * FROM Customers WHERE CustomerName LIKE ‘a%’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Return all customers from a city that starts with ‘L’ followed by one wildcard character, then ‘nd’ and then two wildcard characters:

A

SELECT * FROM Customers WHERE city LIKE ‘L_nd__’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The % wildcard represents any number of characters, even zero
characters.
Return all customers that starts with ‘La’:

A

SELECT * FROM Customers WHERE CustomerName LIKE ‘La%’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Return all customers that starts with ‘a’ or starts with ‘b’:

A

SELECT * FROM Customers WHERE CustomerName LIKE ‘a%’ OR
CustomerName LIKE ‘b%’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Return all customers that ends with ‘a’:

A

SELECT * FROM Customers WHERE CustomerName LIKE ‘%a’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Return all customers from a city that contains the letter ‘L’:

A

SELECT * FROM Customers WHERE city LIKE ‘%L%’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

SELECT in Return all customers from ‘Germany’, ‘France’, or ‘UK’

A

SELECT * FROM Customers WHERE Country IN (‘Germany’, ‘France’, ‘UK’);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Return all customers from ‘Germany’, ‘France’, or ‘UK’

A

SELECT * FROM Customers WHERE Country NOT IN (‘Germany’, ‘France’,
‘UK’);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

SELECT NOT Select only the customers that are NOT from Spain:
Syntax
SELECT column1, column2, …
FROM table_name
WHERE NOT condition;

A

SELECT * FROM Customers
WHERE NOT Country = ‘Spain’;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Condition Not Like

A

SELECT NOT LIKE SELECT * FROM Customers
WHERE CustomerName NOT LIKE ‘A%’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly