sql-select Flashcards

1
Q

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

A

SQL is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS).
SQL is a declarative programming language (programmers describe the results they want and the programming environment comes up with its own plan for getting those results) and JavaScript is an imperative programming languages ( you basically tell the JavaScript runtime what to do and 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 “keyword”,

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 operator “table”= ‘text value’
where “product”.”category” = ‘cleaning’
(after the from clause)

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

consistent style and therefore 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

=, and !=

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

comes last. includes a literal integer number w/ no quotes

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

replacing the list of column names with an * asterisk.

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

with keyword desc

order by “price” desc

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