sql-select Flashcards

1
Q

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

A

Declarative language, we tell it what to do and it figures out how to do it

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

Select statement, select keyword, 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

where clause followed by condition

column and table names: “”
values: ‘’

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
  • standardized
  • legible
  • easier to debug
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

! = , <> Not equal
> , > = Greater than, greater than or equal to
< , < = Less than, less than or equal to
BETWEEN … AND … Inclusive of two values

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

limit clause

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

order by

will sort by default A-Z/0-9
-use desc to reverse

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