SQL-Select Flashcards
What is SQL and how is it different from languages like JavaScript?
it eliminates the need to specify how to reach a record, e.g. with or without an index.
How do you retrieve specific columns from a database table?
Using the SELECT statement followed by the column name and then using the FROM statement to choose the table where the column is from
How do you filter rows based on some specific criteria?
by using the WHERE clause
What are the benefits of formatting your SQL?
.Helps us to make the queries more readable and easy to understand.
.When the queries are formatted and laid out with proper spacing it comes easy to find the errors in the query and fix the error.
.Formatted queries are easy to be passed on to the fellow developers.
.Helps in increasing the efficiency of the database transaction system.
.Makes it easy to scale and deploy the database system.
What are four comparison operators that can be used in a where clause?
equal =
less than <
greater that >
not equal !=
How do you limit the number of rows returned in a result set?
Using the LIMIT clause followed by a numerical value indicating the number of rows you want to return
How do you retrieve all columns from a database table?
SELECT *
How do you control the sort order of a result set?
Use the ORDER BY clause