SQL Flashcards
What is SQL and how is it different from languages like JavaScript?
Structured Query Language
primary way of retrieving, creating, and manipulating data in a relational database.
-A declarative language (programmers describe the results they want and the programming environment comes up with its own plan for getting those results)
How do you retrieve specific columns from a database table?
Select statement
How do you filter rows based on some specific criteria?
Where keyword followed by a statement that is either truthy or falsy
What are the benefits of formatting your SQL?
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?
Limit statement
How do you retrieve all columns from a database table?
*
How do you control the sort order of a result set?
Order by statement
How do you add a row to a SQL table?
Insert into “table” (“column”, “names”)
‘new value’, ‘new value
What is a tuple?
list of values
How do you add multiple rows to a SQL table at once?
comma separated list of tuples
How to you get back the row being inserted into a table without a separate select statement?
returning *
How do you update rows in a database table?
Update statement
Why is it important to include a where clause in your update statements?
Otherwise, you update the WHOLE database
How do you delete rows from a database table?
delete from “table”
where “condition”