sql Flashcards
What is SQL and how is it different from languages like JavaScript?
its a declarative programming language the primary way of interacting with relational databases. It is a powerful way of retrieving, creating, and manipulating data in a relational database.
javascript is not a declarative language unlike sql
How do you retrieve specific columns from a database table?
you query them using the select and from statements
How do you filter rows based on some specific criteria?
using select, from, where, and limit
What are the benefits of formatting your SQL?
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?
How do you retrieve all columns from a database table?
How do you control the sort order of a result set?
How do you add a row to a SQL table?
An SQL insert statement is a means of adding rows to a table.
What is a tuple?
In SQL, a list of values is referred to as a tuple.
“name”, “description”, “price”, “category”
How do you add multiple rows to a SQL table at once?
by specifying more than one tuple of values, separated by commas.
values (‘Ostrich Pillow’, ‘Feel comfy and cozy!’, 99, ‘self care’),
(‘Tater Mitts’, ‘Scrub some taters!’, 6, ‘cooking’)
How do you get back the row being inserted into a table without a separate select statement?
returning *;??????????????
How do you delete rows from a database table?
How do you accidentally delete all rows from a table?
What is a foreign key?
a column or combination of columns that is used to establish and enforce a link between the data in two tables