sql Flashcards
How do you retrieve specific columns from a database table?
use select and put the column name in the double quotes and put the key word from.
How do you filter rows based on some specific criteria?
use where clause
What are the benefits of formatting your SQL?
readible
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
How do you retrieve all columns from a database table?
asterisk
How do you control the sort order of a result set?
order by clause
What is SQL and how is it different from languages like JavaScript?
Sql is a declarative language. JavaScript is imperative language.
How do you add a row to a SQL table?
insert into “Table Name”
What is a tuple?
a list of values
How do you add multiple rows to a SQL table at once?
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 (returning *)
How do you update rows in a database table?
update “products”
set “price” = 100;
Why is it important to include a where clause in your update statements?
You may update many rows if you did not target specific rows.
How do you delete rows from a database table?
delete from “products”
where “productId” = 24