SQL Quiz Questions Flashcards
What is SQL and how is it different from languages like JavaScript?
Structured Query Language (SQL) is the primary way of interacting with relational databases. It is a powerful way of retrieving, creating, and manipulating data in a relational database. SQL is a declarative programming language whereas JavaScript is imperative.
How do you retrieve specific columns from a database table?
with the select keyword and the specific column in quotes
How do you filter rows based on some specific criteria?
the where clause
What are the benefits of formatting your SQL?
consistency and readability
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?
The limit clause
How do you retrieve all columns from a database table?
The * asterisk
How do you control the sort order of a result set?
the order by clause
How do you add a row to a SQL table?
The insert keyword
What is a tuple?
a list of values
How do you add multiple rows to a SQL table at once?
Data rows can be batch inserted into a database table by specifying more than one tuple of values, separated by commas
How to you get back the row being inserted into a table without a separate select statement?
by using the returning clause and an asterisk
How do you update rows in a database table?
update statement
Why is it important to include a where clause in your update statements?
to specify the data that is being updated
How do you delete rows from a database table?
the SQL delete statement