sql select Flashcards
What is SQL and how is it different from languages like JavaScript?
Structured Query Language
backend language used for interacting with relational databases
declarative like HTML/CSS, JS is imperative
How do you retrieve specific columns from a database table?
select “column1”,
“column2”
from “table”;
How do you filter rows based on some specific criteria?
select “column1”,
“column2”
from “table”
where “columnName” = ‘string’;
What are the benefits of formatting your SQL?
consistency, easier to read
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?
select “column1”,
“column2”
from “table”
limit max; // max is an integer
How do you retrieve all columns from a database table?
select *
from “table”
How do you control the sort order of a result set?
select *
from “table”
order by “columnName”;