SQL-Select Flashcards

1
Q

What is SQL and how is it different from languages like JavaScript?

A

it eliminates the need to specify how to reach a record, e.g. with or without an index.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you retrieve specific columns from a database table?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you filter rows based on some specific criteria?

A

by using the WHERE clause

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the benefits of formatting your SQL?

A

.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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are four comparison operators that can be used in a where clause?

A

equal =
less than <
greater that >
not equal !=

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you limit the number of rows returned in a result set?

A

Using the LIMIT clause followed by a numerical value indicating the number of rows you want to return

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you retrieve all columns from a database table?

A

SELECT *

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you control the sort order of a result set?

A

Use the ORDER BY clause

How well did you know this?
1
Not at all
2
3
4
5
Perfectly