SQL Flashcards
What is SQL and how is it different from languages like JavaScript?
SQL the primary way of interacting with relational databases. It is a way of retrieving, creating, and manipulating data in a relational database. It is different from JS because it is a declarative language.
How do you retrieve specific columns from a database table?
select “ “, “ “, …. from “ “;
How do you filter rows based on some specific criteria?
where clause
What are the benefits of formatting your SQL?
readability
What are four comparison operators that can be used in a where clause?
= , , !=
How do you limit the number of rows returned in a result set?
limit clause
How do you retrieve all columns from a database table?
*
How do you control the sort order of a result set?
order by “ “ (optional - desc)
How do you add a row to a SQL table?
insert into …
values
What is a tuple?
a list of values
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 clause
How do you update rows in a database table?
update statement
set command
Why is it important to include a where clause in your update statements?
Otherwise, every value in the specified column would be changed
How do you delete rows from a database table?
delete statement
where clause