SQL Key Words Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What will you use for getting special column from a table?

A

SELECT

FROM

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

How to tell SQL where the end of your query is?

A

;(semicolon)

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

If you want to return a certain number of results, what can you use?

A

LIMIT

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

If you want to select all the unique values from a column, what can you use?
If use Numpy, what can you use?

A

DISTINCT

numpy.unique(sequence)

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

If you want to know how many rows in a table, what can you use?
How many non-missing values in a column, what can you use?

A

COUNT(*)

COUNT()

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

If you want to filter based on both text and numeric values in a table, it is often with comparison operators and comes after the FROM, what can you use?

A

WHERE

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

In SQL, what can you use for not equal operator? As per the SQL standard.

A

<>

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

Which version of SQL you will use single quotes with WHERE, like ‘WHERE’?

A

PostgreSQL

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

Using IOS date format, what January 22th,2008 will be?

A

‘2008-01-22’

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

If you want to select data based on multiple conditions, what the keyword can you build up your WHERE queries by combining multiple conditions with?

A

AND

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

What will you need to specify separately for every AND condition?

A
the column name
For example :
SELECT title
FROM films
WHERE release_year > 1991
AND release_year < 2008
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

If you want to select rows that meet some but not all conditions, what will you use?

A

AND

OR

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

Displaying rows that meet one of the specified conditions, what can you use?

A

OR

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
What can you use alternatively like the following:
SELECT *
FROM people
WHERE age >= 10
AND age <= 14;
A

SELECT *
FROM people
WHERE age
BETWEEN 10 AND 14;

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

Checking for range in SQL, what can you use?

It is not like range() in Python, cause it’s inclusive.

A

BETWEEN

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

If you want to filter based on many conditions making it easier and quicker to specify multiple OR conditions, what can you use with WHERE?

A

IN

17
Q

In SQL, what represents a missing or unknown value?

A

NULL

18
Q

What expression can you use for checking NULL values?

What about not missing values?

A

IS NULL

IS NOT NULL

19
Q

To searching for a pattern in a column, what can you use in a WHERE clause?

A

LIKE

20
Q

To searching for a pattern in a column, what wildcard will match 0,1,or many characters in text?

A

%

21
Q

To searching for a pattern in a column, what wildcard will match a single character in text?

A

_

22
Q

SQL provides a few functions to perform some calculation on the data in a database, what’s its name?

A

Aggregate functions

23
Q

To get the average value from a column of table, what can you use?

A

AVG()

24
Q

To get the highest value from a column of table, what can you use?

A

MAX()

25
Q

To get the result of adding up the numeric values from a column of table, what can you use?

A

SUM()

26
Q

Using aggregate functions, you can perform basic arithmetic with symbols, what are they?

A

+ - * /

27
Q

To avoid using multiple same functions result, SQL allows you aliasing simply means you assign a temporary name to something. What can you use?

A

AS
Like ‘as’ keyword in Python:
import numpy as np

28
Q

In SQL, if you want to sort results in ascending or descending order according to the values of one or more columns, what keyword can be used?

A

ORDER BY

29
Q

By default ORDER BY will sort in ascending order. If you want to sort the results in descending order, what can you use?

A

DESC

30
Q

ORDER BY can be used to sort on multiple columns. What is important using it?

A

The order of columns.

31
Q

If you want to hybrid SELECT operation between string and numeric data type in SQL, what can you use?

A

GROUP BY

32
Q

What keyword always goes after the FROM clause?

A

GROUP BY

33
Q

When combining GROUP BY and ORDER BY. Make sure to always put the ORDER BY clause at the end of your query. Why ?

A

I can’t sort values that haven’t calculated yet!

34
Q

If you want to filter based on the result of an aggregate function, what can you use?

A

HAVING