EXAM 2 (Mods 3-5) Flashcards

1
Q

What is the computer’s order of execution for the select statement clauses?

A

1: FROM
2: WHERE
3: GROUP BY
4: HAVING
5: SELECT
6: ORDER BY

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

What does CRUD stand for?

A

Create, Read, Update, Delete

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

Do the Select statement commands/clauses fall within DML, QL, or DDL

A

QL

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

What is the meaning of the following Reg expression operator;
<>

A

not equal

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

Which “optional” SELECT clause is mandatory for data aggregation?

A

GROUP BY

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

Which select statement clause(s) support aliases?

A

all but WHERE

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

Which clause(s) don’t support aggregate functions?

A

WHERE & FROM

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

What are the three purposes of the select statement and the associated clause responsible for each?

A

1) Projection -> SELECT
2) Selection -> WHERE
3) Join -> FROM (implicit)

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

What are the two main join syntax styles in SQL?

A

Implicit- FROM/WHERE
Explicit- <”some join type”> JOIN ON

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

How are tables most commonly joined

A

Equi joins on Pk-Fk

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

Can outer joins be only implicit or only explicit?

A

explicit

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

Which type of join will produce the fewest # of rows back?

A

Inner Join

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

What type of join does the FROM/WHERE syntax perform?

A

inner

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

If you want to preserve the rows of the second table in your join, which type should you use? Which table’s null fields will be included in the output?

A

RIGHT OUTER
The first/left table

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

What type of join will the following statement produce?
Select *
From Table_1, Table_2

A

Cartesian Product

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

If table 1 had 200 rows and table 2 has 150 rows, how many rows will be returned from a FULL OUTER Join between the two tables?

A

200

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

which table (left, middle, or right) of a nested join is the table that resolves the many-to-many relationship aka is the “bridging table”

A

The right table

17
Q

What is a sub-query? and what clauses are supported within a sub-query?

A

A SELECT statement within a SELECT-Statement
Supports WHERE, GROUP By, HAVING and sometimes SELECT

18
Q

When will the condition be true with the ANY operator?

A

condition is true if the operator is true for any of the values in the range- think ‘or’ in programming

19
Q

When will the condition be true with the All operator?

A

When the operator is true for all the values in the range- think programming AND

20
Q

Is the BETWEEN operator inclusive or exclusive, and which clause can it be used with?

A

Inclusive, WHERE

21
Q

What does the IN operator do?

A

Allows you to specify multiple values in a WHERE Clause

22
Q

Wildcards for the Like operator?

A

% which represents zero, one, or multiple characters
_ which represents a single character
[charlist] any single character within charlist

23
Q

Wildcards for the RLIKE (~*) operator

A

.* which represents zero, one, or multiple characters
. which represents a single character
[charlist] any single character within charlist

24
What does DML stand for?
Data Manipulation Language
25
What are the three key commands of DML?
INSERT UPDATE' DELETE
26
Does DML deal with rows/columns or objects/tables
Rows/Columns
27
What Does DDL Stand for?
Data Definition Language
28
What are the three main commands of DDL?
CREATE ALTER DROP
29
What does DCL stand for and what are it's two main commands?
Data Control Language REVOKE, GRANT
30
what does ACID stand for?
Atomicity, Consistency, Isolation, and Durability
31
Name the following SIRDs 4326, 269__, 3857, 3005, 326__, 4267, 3978
WGS 84 (lat/long), NAD 83 UTM zone __, WGS 84 Web Mercator, MELP-Albers, WGS 84 UTM zone __, NAD1927 (lat,long), Canada atlas lambert
32
what are the SRIDs for the following Canada Atlas Lambert WGS 84 (lat/long) NAD 83 UTM zone __ Melp-Albers WGS 84 Web Mercator WGS 84 utm zone __ NAD 1927 (lat,long)
3978 4326 269__ 3005 3857 326__ 4267
33
what operators are supported by the Btree indexing method?
range and equality
34
which indexing method supports spatial E-Tree and Quad-Tree?
GiST and SP-GiST
35
what operators does GIN support?
array, ranges, JSONB
36
Which indexing method only supports equality
HASH/BITMap
37
what are the two most powerful DML and DDL statements for GIS?
1) CREATE TABLE {table_name} AS {select-statement} 2) INSERT INTO {table_name} (field_1, field_n) SELECT field_1, field_n FROM... WHERE...
38
What is the difference between an INSERT, UPDATE, and ALTER?
Insert command is used to insert a new row to an existing table, Update is a SQL command that is used to update existing records in a database, while alter is a SQL command that is used to modify, delete or add a column to an existing table in a database. Insert and Update are DML statements, whereas alter is a DDL statement. Alter command modifies the database schema, while insert and update statements only modify records in a database or insert records into a table without modifying its structure.
39
which two commands would you use to remove a column from a table?
ALTER (table), DROP (column)