Basic commands Flashcards

1
Q

Select everything from the Customers table

A

SELECT * FROM Customers

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

Select all values from the City column in the Customer table

A

SELECT City FROM Customers

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

Select all the different values in the City column in the Customers table

A

SELECT DISTINCT City FROM Customers

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

Select the City and Address columns from the Customers table

A

SELECT City, Address FROM Customers

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

Show a count of how many distinct values there are in the City Column in the Customers table

A

SELECT COUNT (DISTINCT City) FROM Customers

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

Select all colums from the Customers table where country is equal to Mexico

A

SELECT * FROM Customers WHERE Country = ‘Mexico’

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

Select all columns from the Customer table where the UseId is 3434

A

SELECT * FROM Customers WHERE UserId = 3434

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

Select all fields from “Customers” where country is “Germany” and city is “Berlin”

A

SELECT * FROM Customers WHERE Country = “Germany” AND City = “Berlin”

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

Select all fields from “Customers” where city is “Berlin” or “München”

A

SELECT * FROM Customers WHERE City = “Berlin” OR City = “München”

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

Select all fields from “Customers” where country is NOT “Germany”

A

SELECT * FROM Customers WHERE NOT Country = ‘Germany’

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

Selects all fields from “Customers” where country is “Germany” AND city must be “Berlin” OR “München”

A

SELECT * FROM Customers

WHERE Country = ‘Germany’ AND (City = ‘Berlin’ OR City=”München”)

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

Select all customers from the “Customers” table, sorted by the “Country” column

A

SELECT * FROM Customers

ORDER BY Country;

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

Selects all customers from the “Customers” table, sorted DESCENDING by the “Country” column

A

SELECT * FROM Customers

ORDER BY DESC Country

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

Selects all customers from the “Customers” table, sorted ascending by the “Country”

A

SELECT * FROM Customers

ORDER BY ASC Country

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