SQL Flashcards
How do you add a row to a SQL table?
Insert into ‘TableName’, (Columns), (Values)
What is a tuple?
a group of things be inserted into a table
How do you add multiple rows to a SQL table at once?
You just add more values and separate with commas
How do you get back the row being inserted into a table without a separate select statement?
Add return ‘col1’, ‘col2’ or * for all
How do you update rows in a database table?
update ‘tableName’ set ‘column you want to change’ = ‘new value’
How do you update rows in a database table?
update ‘tableName’ set ‘column you want to change’ = ‘new value’
Why is it important to include a where clause in your update statements?
So you only change a specific row
How do you delete rows from a database table?
delete from ‘tableName’ where ‘row’
How do you accidentally delete all rows from a table?
delete from ‘tableName’
What is a foreign key?
a column of data that points to a unique value in another table
How do you join two SQL tables?
join ‘tableName’ using ‘valueName’
How do you temporarily rename columns or tables in a SQL statement?
as
What is SQL and how is it different from languages like JavaScript?
It is a query based language
How do you retrieve specific columns from a database table?
select then column names
How do you filter rows based on some specific criteria?
where clause