Basics Flashcards
(13 cards)
What is a table schema?
Contains all the relationships between tables excluding data
*useful for testing without importing confidential information
What is used to end a clause/statement?
;
What is the basic syntax that forms a SELECT statement?
SELECT FROM ;
How do you select multiple things with a SELECT statement?
SELECT ,,;
What can be used to select unique values only in a table?
DISTINCT
SELECT DISTINCT FROM ;
What can be used to perform logic on values returned from SELECT?
WHERE
i.e: SELECT FROM WHERE = ;
What are the operators for a WHERE statement?
= > < >= <= != or <> AND OR
How do you reference a string when performing logic with WHERE?
enclose in single quotes
‘’
What syntax can be used to count the number of rows returned by a SELECT statement?
COUNT
i.e:
SELECT COUNT(*) FROM ;
SELECT COUNT(DISTINCT ) FROM ;
What syntax can be used to limit the number of rows returned by a query?
LIMIT
SELECT FROM LIMIT ;
What is the syntax to order columns returned something in ascending or descending order?
ORDER BY
SELECT FROM ORDER BY ;
Why would you ORDER BY for multiple columns?
If the first columns are identical the second ordering will take effect
i.e:
SELECT FROM ORDER BY ASC, ASC;
What is one unique aspect of PostgreSQL compared to other databases?
It allows sorting of information that is not explicitly stated in the SELECT clause