Basics Flashcards Preview

SQL > Basics > Flashcards

Flashcards in Basics Deck (13)
Loading flashcards...
1

What is a table schema?

Contains all the relationships between tables excluding data

*useful for testing without importing confidential information

2

What is used to end a clause/statement?

;

3

What is the basic syntax that forms a SELECT statement?

SELECT FROM ;

4

How do you select multiple things with a SELECT statement?

SELECT ,,;

5

What can be used to select unique values only in a table?

DISTINCT

SELECT DISTINCT FROM ;

6

What can be used to perform logic on values returned from SELECT?

WHERE

i.e: SELECT FROM WHERE = ;

7

What are the operators for a WHERE statement?

=
>
<
>=
<=
!= or <>
AND
OR

8

How do you reference a string when performing logic with WHERE?

enclose in single quotes
''

9

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 ;

10

What syntax can be used to limit the number of rows returned by a query?

LIMIT

SELECT FROM LIMIT ;

11

What is the syntax to order columns returned something in ascending or descending order?

ORDER BY

SELECT FROM ORDER BY ;

12

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;

13

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