sql-select Flashcards
What is SQL and how is it different from languages like JavaScript?
SQL is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS).
SQL is a declarative programming language (programmers describe the results they want and the programming environment comes up with its own plan for getting those results) and JavaScript is an imperative programming languages ( you basically tell the JavaScript runtime what to do and how to do it)
How do you retrieve specific columns from a database table?
select statement “keyword”,
How do you filter rows based on some specific criteria?
where clause operator “table”= ‘text value’
where “product”.”category” = ‘cleaning’
(after the from clause)
What are the benefits of formatting your SQL?
consistent style and therefore readability.
What are four comparison operators that can be used in a where clause?
=, and !=
How do you limit the number of rows returned in a result set?
limit clause
comes last. includes a literal integer number w/ no quotes
How do you retrieve all columns from a database table?
replacing the list of column names with an * asterisk.
How do you control the sort order of a result set?
with keyword desc
order by “price” desc