Unit 3 Database - Implementation - SQL FROM, ORDER BY and WHERE Flashcards

1
Q

What does the FROM clause do?

A

It states which table or tables to get the data from.

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

What is the syntax of the FROM clause?

A

FROM table1, table2, …

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

What does the WHERE clause do?

A

It filters the data based on specified conditions.

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

What is the syntax of the WHERE clause?

A

WHERE column1 comparator1 value1 AND|OR column2 comparator2 value2 …

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

What does the equal sign (=) do in SQL?

A

It matches a value exactly. Example: WHERE userid = 70000.

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

What does the less than (<) operator do?

A

It selects values smaller than the given value. Example: WHERE customerid < 3938.

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

What does the greater than (>) operator do?

A

It selects values greater than the given value. Example: WHERE customerid > 500.

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

What does the AND operator do in SQL?

A

It ensures both conditions must be true. Example: WHERE customerid < 3938 AND userid = 70000.

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

What does the OR operator do in SQL?

A

It ensures at least one condition must be true. Example: WHERE customerid < 3938 OR userid = 70000.

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

What does the ORDER BY clause do?

A

It sorts the results of a query based on specified columns.

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

What is the syntax of the ORDER BY clause?

A

ORDER BY column1 ASC|DESC, column2 ASC|DESC, …

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

What happens if no sorting order is specified in ORDER BY?

A

Data is automatically sorted in ascending (ASC) order.

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

How does ORDER BY sort numbers?

A

Lowest at the top and highest at the bottom.

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

How does ORDER BY sort letters?

A

A at the top and Z at the bottom.

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

How can you sort by one column?

A

Example: SELECT * FROM hairdresser ORDER BY hairdresserid DESC.

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

How can you sort by multiple columns?

A

Example: SELECT * FROM client ORDER BY hairdresserid DESC, phonenumber ASC.