Final Flashcards

1
Q

what is a database?

A

a structured collection of related meaningful data

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

what is a database managemet system?

A

tool for accessing a database

  • redundancy control
  • access control
  • storage
  • querying
  • backup
  • concurrent access
  • enforcing constraints
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what are the layers of abstraction

A

external (user), conceptual (schemas), internal (data mapping)

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

what is the entity relationship model?

A

is a data model designed for the purpose of representing the semantics associated with data from the miniworld. The ERM is used in the conceptual design stage, where the conceptual scheme of the application’s database is conceived

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

the conceptual scheme that is created based on the entity-relationship model is called what?

A

Entity-relationship diagram (ERD)

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

what is an entity?

A

something in the real world that exists independently

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

what is an attribute?

A

information about an entity (ex. gender, dob, city of birth, etc.)

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

what is a composite attribute?

A

an attribute composed of parts (ie. address to components)

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

what is a multi-valued attribute

A

an attribute that may be composed by a group of values (ie. patient has more than one telephone number)

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

what is a derived attribute?

A

an attribute obtained by processing other attributes (ie. age = date - dob)

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

what is the cardinality ratio?

A

cardinality ratio specifies the number of relationship instances in which an entity can participate.
(patient HAS sample has cardinality of 1:N ie. one patient can have n sample entitities)

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

what are the mysql data types?

A
  • int
  • varchar
  • boolean
  • double
  • float
  • date
  • datetime
  • char
  • text
  • enum
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

insert rows into a table

A

insert into

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

how do you specify a primary key

A

primary key (id)

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

how do you specify a unique key?

A

unique key (name)

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

how to delete a table

A

drop table name

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

what is the format of a select

A

select col_name from tbl_name where ___

18
Q

what is the not equals sign

A

<>

19
Q

what is the form of the update statement

A

update tbl_name SET col_name = __

where attribute= __

20
Q

what is a schema? (conceptual schema)

A

a table set of constraints on data

21
Q

what is a relation?

A

a table and all its entries

22
Q

what is a relation schema?

A

the set of constraints on the relation

23
Q

what is a domain constraint

A

restricts the domain of an attribute (int, varchar, float)

24
Q

what is a key constraint

A

requires that entries in a column or combination of columns be unique

25
Q

what is an entity constraint

A

primary keys cannot be null

26
Q

what is a referential constraint

A

requires that an attribute be present in another table

27
Q

what is a semantic contraint

A

rules about the system outside of the database

28
Q

how do you represent an ER diagram of employees managing departments

A

[employee] 1 - <> = 1 [department]

29
Q

what is a foreign key constraint?

A

a constraint that says an attribute can only contain values that are the primary key of a specified table

30
Q

what changes can break a foreign key relationship?

A
  • update

- delete

31
Q

how do you add a foreign key reference

A

foreign key (cid) references tbl_name (id)

32
Q

which level of abstraction is the ER model most concerned with?

A

conceptual (providing a high-level description of data)

33
Q

which is created first when designing a database, the ER model or the schema?

A

ER model

34
Q

the insert command may violate which constraint

  • domain
  • key
  • referential
  • all
A

all of the above

35
Q

the delete command may violate which constraint

  • domain
  • key
  • referential
  • all
A

referential

36
Q

what does an inner join join on?

A

set of matching records on both tables

37
Q

what is the purpose of “having”

A

allows you to perform conditional (where) on an aggregate function
ie. having sum(field > value)

38
Q

SELECT name FROM people WHERE id NOT IN (SELECT p.id FROM people p INNER JOIN people_jobs pj on pj.pid = p.id); yields what?

A

name of person without job

39
Q

SELECT name FROM people WHERE id NOT IN (SELECT p.id FROM people p INNER JOIN people_jobs pj on pj.pid = p.id); what would happen if there was a null attribute in the pid column from person_job?

A

the subquery would return null and not in doesn’t handle null well and will return null

40
Q

T/F: A foreign key with casade delete means that if a record in the reference table is deleted, then the corresponding records in the referencing table will automatically be deleted

A

True