Sequel/Databases Flashcards
What is SQL and how is it different from languages like JavaScript?
coding language used to interact with databases
How do you retrieve specific columns from a database table?
select
How do you filter rows based on some specific criteria?
where “column” = ‘condition’
What are the benefits of formatting your SQL?
more easily readable
What are four comparison operators that can be used in a where clause?
= < ><= >= <> (not equal)
How do you limit the number of rows returned in a result set?
limit (number);
How do you retrieve all columns from a database table?
select *
How do you control the sort order of a result set?
desc keyword after the statement
order by “price” desc
How do you add a row to a SQL table?
insert into “table” (values)
What is a tuple?
In SQL, a list of values is referred to as a tuple.
How do you add multiple rows to a SQL table at once?
Data rows can be batch inserted into a database table by specifying more than one tuple of values, separated by commas.
How do you get back the row being inserted into a table without a separate select statement?
returning *;
How do you update rows in a database table?
update statement
Why is it important to include a where clause in your update statements?
sets a limit to prevent all values from being changed
How do you delete rows from a database table?
delete statement