Fetch Data, Insert/Edit Rows and Tables Flashcards

1
Q

What do SELECT statements do?

A

fetch data from a database

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

What do FROM statements do?

A

specify the name of the table to query data from

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

What is the basic SELECT / FROM statement format?

A

SELECT column_name FROM table_name;

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

What does the asterisk * mean in the SELECT * FROM command?

A

It means that you will select every column in the table, without individually listing each column name

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

What do INSERT INTO statements do?

A

insert new rows into a table

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

What is the basic INSERT INTO statement format?

A

table_name (column1_name, column2_name, column3_name) VALUES (row1_value, row2_value, row3_value);

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

How do you denote text in SQL?

A

place it within a set of apostrophes (example, ‘Batgirl’)

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

What do UPDATE statements do?

A

edit existing rows

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

What do SET statements do?

A

indicate the column to edit

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

What do WHERE statements do?

A

indicate which rows to update with the new column value

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

What is the basic UPDATE statement format?

A

UPDATE table_name SET column_name = new_value WHERE row_identifier1 = row_identifier2;

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

What do DELETE FROM statements do?

A

remove rows that meet a certain criteria

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

What is the basic DELETE FROM statement format?

A

DELETE FROM table_name WHERE column_name IS value;

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

What do ALTER TABLE statements do?

A

add or remove columns

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

What do ADD COLUMN statements do?

A

add a column to the table

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

What do REMOVE COLUMN statements do?

A

remove a column from the table

17
Q

What is the basic ALTER TABLE statement format?

A

ALTER TABLE table_name ADD COLUMN column_name DATA_TYPE;

18
Q

What is a NULL value?

A

a special value in SQL that represents missing or unknown data