sql-select Flashcards

1
Q

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

A

SQL is a language used in querying relational databases. It is a powerful way of retrieving, creating, and manipulating data in a relational database.
It is declarative because you describe to the computer what you want to do and it carries it out for you in the best way it can while JavaScript is 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

select columns from the table

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

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 helps narrow down only the information of import at the time we need it as databases can contain millions of rows

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

limit

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

By using the universal selector ‘*’

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 desc (descending) or order by (ascending)

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