sql Flashcards

1
Q

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

A

its a declarative programming language the primary way of interacting with relational databases. It is a powerful way of retrieving, creating, and manipulating data in a relational database.

javascript is not a declarative language unlike sql

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 query them using the select and from statements

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

using select, from, where, and limit

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
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
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you add a row to a SQL table?

A

An SQL insert statement is a means of adding rows to a table.

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

What is a tuple?

A

In SQL, a list of values is referred to as a tuple.

“name”, “description”, “price”, “category”

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

How do you add multiple rows to a SQL table at once?

A

by specifying more than one tuple of values, separated by commas.
values (‘Ostrich Pillow’, ‘Feel comfy and cozy!’, 99, ‘self care’),
(‘Tater Mitts’, ‘Scrub some taters!’, 6, ‘cooking’)

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

How do you get back the row being inserted into a table without a separate select statement?

A

returning *;??????????????

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

How do you delete rows from a database table?

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

How do you accidentally delete all rows from a table?

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

What is a foreign key?

A

a column or combination of columns that is used to establish and enforce a link between the data in two tables

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

How do you join two SQL tables?

A

using the join statement

17
Q

How do you temporarily rename columns or tables in a SQL statement?

A

using the ‘as’ keyword

18
Q

What are some examples of aggregate functions?

A
19
Q

What is the purpose of a group by clause?

A