Distinct, As, Where Flashcards

1
Q

What is the primary purpose of querying data?

A

Retrieving specific information or subsets from a database

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

What command is used to specify which columns and rows to retrieve in SQL?

A

SELECT

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

What clause is used to filter results based on specific criteria in SQL?

A

WHERE

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

What does the ORDER BY clause do?

A

Arranges the data in a particular order, such as ascending or descending

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

What is the function of the LIMIT clause?

A

Restricts the number of rows returned by a query

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

What is an alias in SQL?

A

A temporary and more readable name for a table or column within a query

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

Which keyword is used to assign an alias in SQL?

A

AS

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

Fill in the blank: The MAX function is used to find the _______ value in a column.

A

highest

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

True or False: The ORDER BY clause can only sort data in ascending order.

A

False

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

What is a practical use of the WHERE clause in SQL?

A

Filtering results based on conditions, such as retrieving employees with a specific salary

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

What SQL statement can be used to fetch specific columns and rows from a database?

A

SELECT statement

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

How can you sort employee details by first name in ascending order?

A

Using the ORDER BY clause

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

What is the purpose of using the LIMIT clause in a query?

A

To ensure only a specified number of rows are retrieved

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

What would the query SELECT * FROM employees WHERE salary = 8000 do?

A

Retrieve all employee details with a salary equal to 8000

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

What SQL function would you use to find the highest salary in a table?

A

MAX

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

Fill in the blank: The LIMIT clause can ensure only the first _______ rows are retrieved.

A

n

17
Q

True or False: Aliases are permanent names assigned to tables or columns in SQL.

A

False