Module10_SQL_Primter Flashcards

1
Q

what are the 3 numeric data types

A

Numeric: number with presision
integer:
serial: automatic generating INT starts with 1 + 1

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

what are the 3 charcter data types

A

char:
varchar:
text: like clob for big data

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

what are the 4 date / time data types?

A

Timestamp
date
time
interval

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

what are DDL commands

A

create
alter
drop
truncate

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

what are DML commands

A

insert
update
delete
select

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

what are DCL command?

A

Data control language like GRANT & REVOKE

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

what are TCL commands?

A

Transaction control language like:
Commit
rollback
savepoint
set transaction

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

what are the 5 constraints

A

not null
check
unique
primary key
foreign key

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

when to use a domain

A

if you want to create your own data type with optional constraint.
Like Domain: City
with allowed values: Amsterdam and Paris.

This is like a check constraint but a domain can be used in many table where check constraint needs to be created per table.

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

what is an inner join

A

returns only matching rows from both table

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

what is an left outer join

A

returns all matching rows and rows from left table

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

what is an right outer join

A

return all matching rows and all rows from right

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

what is an full outer join

A

A full outer join is a combination of a left outer and right outer join. It returns all rows in both tables that match the query’s where clause, and in cases where the on condition can’t be satisfied for those rows it puts null values in for the unpopulated fields.

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

what is an cross join

A

A cross join produces a cartesian product between the two tables, returning all possible combinations of all rows. It has no on clause because you’re just joining everything to everything.

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

how do we quote a ‘ or “ in postgres

A

by setting $$ at the beginnen and end $$
or
by setting $any_text$ at the beginnen and end $any_text$

when quoting a table with “Case” it makes the table_name case sensitive

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

what are these indexes:
B-TREE
hash
BRIN
GIN
GIST

A

B-Tree: speed up performance
hash: is ideal for compare values
BRIN: for BIG Data envioronments
GIN: for array contents
GIST/SP-GIST: data that contains patterns (pattern compare).