sql-select Flashcards

1
Q

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

A

Structed Query Language is the primary way of interacting with relational databases; it is a powerful way of retrieving, creating, and manipulating data in a relational database. It is different from JS in that it is declarative, instead of being imperative.

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

use select statement and “name” of column

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

use the where clause and “name” of column and then and ‘value’ with an operator in-between

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

readability

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

less than (), greater than, equal to (=), not equal to (!=)

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 followed by the number

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

*

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

use the order by clause followed by the “name” of column and the keyword (desc for descending; ascending order is default).

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