sql-select Flashcards
What is SQL and how is it different from languages like JavaScript?
Structed Query Language is the primary way of interacting with relational databases; it is a powerful way of retrieving, creating, and manipulating data in a relational database. It is different from JS in that it is declarative, instead of being imperative.
How do you retrieve specific columns from a database table?
use select statement and “name” of column
How do you filter rows based on some specific criteria?
use the where clause and “name” of column and then and ‘value’ with an operator in-between
What are the benefits of formatting your SQL?
readability
What are four comparison operators that can be used in a where clause?
less than (), greater than, equal to (=), not equal to (!=)
How do you limit the number of rows returned in a result set?
limit followed by the number
How do you retrieve all columns from a database table?
*
How do you control the sort order of a result set?
use the order by clause followed by the “name” of column and the keyword (desc for descending; ascending order is default).