SQL Select Flashcards

1
Q

What is SQL and how is it different from languages like JavaScript?

A

SQL is a programming language used for interacting with relational database management systems. It is different from JavaScript because it is a declarative language.

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

How do you retrieve specific columns from a database table?

A

You use the select keyword with the names of the columns.

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

How do you filter rows based on some specific criteria?

A

You use a where clause and the name of the attribute compared against the value you want to filter for.

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

What are the benefits of formatting your SQL?

A

It makes your code easier to read.

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

What are four comparison operators that can be used in a where clause?

A

= > < !=

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

How do you limit the number of rows returned in a result set?

A

You use the limit keyword and then number of rows to limit to.

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

How do you retrieve all columns from a database table?

A

select *

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

How do you control the sort order of a result set?

A

You use the order by clause and the attribute you want to order by. Default is ascending order

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