Fetch Data, Insert/Edit Rows and Tables Flashcards
What do SELECT statements do?
fetch data from a database
What do FROM statements do?
specify the name of the table to query data from
What is the basic SELECT / FROM statement format?
SELECT column_name FROM table_name;
What does the asterisk * mean in the SELECT * FROM command?
It means that you will select every column in the table, without individually listing each column name
What do INSERT INTO statements do?
insert new rows into a table
What is the basic INSERT INTO statement format?
table_name (column1_name, column2_name, column3_name) VALUES (row1_value, row2_value, row3_value);
How do you denote text in SQL?
place it within a set of apostrophes (example, ‘Batgirl’)
What do UPDATE statements do?
edit existing rows
What do SET statements do?
indicate the column to edit
What do WHERE statements do?
indicate which rows to update with the new column value
What is the basic UPDATE statement format?
UPDATE table_name SET column_name = new_value WHERE row_identifier1 = row_identifier2;
What do DELETE FROM statements do?
remove rows that meet a certain criteria
What is the basic DELETE FROM statement format?
DELETE FROM table_name WHERE column_name IS value;
What do ALTER TABLE statements do?
add or remove columns
What do ADD COLUMN statements do?
add a column to the table