SQL Key Words Flashcards
What will you use for getting special column from a table?
SELECT
FROM
How to tell SQL where the end of your query is?
;(semicolon)
If you want to return a certain number of results, what can you use?
LIMIT
If you want to select all the unique values from a column, what can you use?
If use Numpy, what can you use?
DISTINCT
numpy.unique(sequence)
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?
COUNT(*)
COUNT()
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?
WHERE
In SQL, what can you use for not equal operator? As per the SQL standard.
<>
Which version of SQL you will use single quotes with WHERE, like ‘WHERE’?
PostgreSQL
Using IOS date format, what January 22th,2008 will be?
‘2008-01-22’
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?
AND
What will you need to specify separately for every AND condition?
the column name For example : SELECT title FROM films WHERE release_year > 1991 AND release_year < 2008
If you want to select rows that meet some but not all conditions, what will you use?
AND
OR
Displaying rows that meet one of the specified conditions, what can you use?
OR
What can you use alternatively like the following: SELECT * FROM people WHERE age >= 10 AND age <= 14;
SELECT *
FROM people
WHERE age
BETWEEN 10 AND 14;
Checking for range in SQL, what can you use?
It is not like range() in Python, cause it’s inclusive.
BETWEEN
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?
IN
In SQL, what represents a missing or unknown value?
NULL
What expression can you use for checking NULL values?
What about not missing values?
IS NULL
IS NOT NULL
To searching for a pattern in a column, what can you use in a WHERE clause?
LIKE
To searching for a pattern in a column, what wildcard will match 0,1,or many characters in text?
%
To searching for a pattern in a column, what wildcard will match a single character in text?
_
SQL provides a few functions to perform some calculation on the data in a database, what’s its name?
Aggregate functions
To get the average value from a column of table, what can you use?
AVG()
To get the highest value from a column of table, what can you use?
MAX()