Exam 1.3 Flashcards

(29 cards)

1
Q

What language are queries written in

A

declarative langauge

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

T or F DB optimize efficiency of running queries

A

T

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

T of F Null values are nuplicates

A

False null values do not count as duplicates

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

How does inserting into a table atheletes(aid, name , country , sport) work

A

you do values(x,x,x,x) wher eeach x is a value that belongs to the type specified in atheletes

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

T or F when inserting into table you need to specify the columns you are inserting into

A

False you can ommit the columns ex Atheletes() if the values are in the correct order that they are listed

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

T of F you can switch order of things inserted into tables

A

True but only if values inserted also matches

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

how does cross product work between 2 tables

A

rows in each of the tables will combine with the rows from the other tables

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

How do select statement work under the hood

A

they are just cross products and then use the constraints to filter out unwanted

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

How to define a view

A

Create view [viewname] ([vars you want in view])
after all that
as is used then after that is a query

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

T of F view can be directly modifiedd

A

False they must be dropped and recreated

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

In relational tables when there is one to many how is data stored and primary key represeted

A

you do not need an extra table you can store foreign key in table representing many side

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

how can participation constaints be shown in relational tables

A

they will have not null

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

How does ON DELETE NO ACTION work

A

usually used after foreign keys and makes the foreign key erference not able to be deleted til child is deleted

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

How are weak entities portrayed in tables

A

they have foreign key to parent element and they have on delete cascade

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

how is a weak entity primary key maintianed

A

their primary key is the combo of parent and their unique keyw

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

Principles of aggregration

A

You must keep primary key of all participation sets

17
Q

What is not in SQL

18
Q

How do you define constaints

A

Constraint [cname]
Check [terms]

19
Q

when does check constraint execute

A

every time table is modified

20
Q

what does check constraint do for empty relation

A

evalues to true

21
Q

Where are constraints defined

A

inside tables

22
Q

What can be used for constraints across multiple functions

A

assertion and triggers

23
Q

How are assertions created

A

CREATE ASSERTION [aname]
CHECK ((the assertion))

24
Q

Which are better to use assertions or triggers

A

triggers because they cost less

25
How doe triggers work
change values depending on if specified changes are made to the dbms
26
Parts of a trigger
event condition action
27
what can update triggers
insert deletion update
28
Syntax for trigger
CREATE TRIGGER [tname] BEFORE UPDATE ON [tableName] FOR EACH ROW DECLARE [anything you want] BEGIN END;
29
Cons of triggers
They can be recursive making a bunch of them hard to predict Mutated trigger error when table modifies same table being modified