Basics Flashcards

(13 cards)

1
Q

What is a table schema?

A

Contains all the relationships between tables excluding data

*useful for testing without importing confidential information

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

What is used to end a clause/statement?

A

;

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

What is the basic syntax that forms a SELECT statement?

A

SELECT FROM ;

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

How do you select multiple things with a SELECT statement?

A

SELECT ,,;

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

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

A

DISTINCT

SELECT DISTINCT FROM ;

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

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

A

WHERE

i.e: SELECT FROM WHERE = ;

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

What are the operators for a WHERE statement?

A
=
>
<
>=
<=
!= or <>
AND
OR
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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

A

enclose in single quotes

‘’

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

What syntax can be used to count the number of rows returned by a SELECT statement?

A

COUNT
i.e:
SELECT COUNT(*) FROM ;
SELECT COUNT(DISTINCT ) FROM ;

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

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

A

LIMIT

SELECT FROM LIMIT ;

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

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

A

ORDER BY

SELECT FROM ORDER BY ;

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

Why would you ORDER BY for multiple columns?

A

If the first columns are identical the second ordering will take effect
i.e:
SELECT FROM ORDER BY ASC, ASC;

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

What is one unique aspect of PostgreSQL compared to other databases?

A

It allows sorting of information that is not explicitly stated in the SELECT clause

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