Database Exam 1

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/87

encourage image

There's no tags or description

Looks like no tags are added yet.

88 Terms

1
New cards

Analysts who focus on database

database analysts and data modelers

2
New cards

a view of the entities, attributes, and relationships involved in the world being modeled (conceptual schema) as well as a view of tables, fields, and primary and foreign keys

designer view

3
New cards

software used to manage databases

DBMS

4
New cards

in traditional file processing, each application shares data files

false

5
New cards

a view that makes this person involved in the physical schema only

admin view

6
New cards

person who oversees the projects and managers the personnel

project manager

7
New cards

people who use the applications and database

end users

8
New cards

departmental multi tiered client/server databases

intended for several users, department wide

9
New cards

person who analyzes the business situation and establishes requirements who has technical expertise for overall information systems

systems analyst

10
New cards

person, place, object, event, or concept about which an organization wishes to maintain data

entity

11
New cards

traditional methodology used to develop, maintain, and replace information systems

systems developed life cycle

12
New cards

in independent file processing systems, unplanned duplicate data files are

the rule rather than the exception

13
New cards

Personnel responsible for maintains the database

database admin

14
New cards

Advantages to database systems

program-data independence

reduced program maintenance

better data quality

15
New cards

metadata typically describes all of the following

length

data type

allowable values

16
New cards

which sql sublanguage is used to define database structures such as tables

DDL

17
New cards

Which SQL sublanguage includes operations such as SELECT, INSERT, UPDATE, and DELETE

DML

18
New cards

Which SQL sublanguage is primarily concerned with database privileges and access control?

DCL

19
New cards

in a database table, a row is called a

record

20
New cards

primary purpose of sql

communicating with and managing relational databases

21
New cards

in a database table, a column is also called a

field

22
New cards

what is a schema

a database blueprint describing its structure

23
New cards

multi variate attributes in ER notation

{inside flower brackets}

24
New cards

type of relationship: employee may have no or one parking space

optional 1:1

25
New cards

in data definitions, a fact is

an association between two or more terms

26
New cards

entity instance

a single person, place, object, event, or concept

27
New cards

relationship with a min and max of 1

mandatory 1:1

28
New cards

type of relationship: order must contain one product but may contain several products

mandatory many

29
New cards

a relationship involving two different entity types

binary

30
New cards

identifiers in ER notation

text with a single underline

31
New cards

a relationship between entities of the same entity type is of ___ degree

unary

32
New cards

relationship type: a customer may place zero, one, or many orders

optional many (0,N)

33
New cards

relationship involving three entity types

ternary

34
New cards

a required attribute must have

a value for every associated entity or relationship instance

35
New cards

an identifier (key) is

an attribute or combination of attributes that uniquely identifies an entity instance

36
New cards

strong entities

exist independently of other entities and have its own unique identifier

37
New cards

derived attribute

an attribute whose value can be calculated from related attribute values

[derived attribute square brackets]

38
New cards

composite attributes

consist of multiple component attributes where all components are required

have meaningful component parts or sub attributes

ex: employee address broken into street, city, state, and postal code

39
New cards

ER models represent

objects of interest to the user that will be represented or displayed through the system

40
New cards

an attribute is

a property or characteristic of an entity or relationship type

41
New cards

multivalued attributes

may take on one or more than one value for one entity or relationship instance

42
New cards

descending order query

ORDER BY x DESC

43
New cards

check is a value is missing

WHERE value IS NULL

44
New cards

in query execution, which clause is executed first

FROM

45
New cards

in ORDER BY x DESC, y DESC, what is y?

a tiebreaker when x value is the same

46
New cards

find names that do not match ‘A%’

WHERE name NOT LIKE ‘A%’

47
New cards

find records where a specific value is present

WHERE x IS NOT NULL

48
New cards

filter grouped or aggregate results using

HAVING

49
New cards

round to nearest hundred

ROUND(value, -3)

50
New cards

Which query stacks results and removes duplicate rows

UNION

51
New cards

what role can a subquery in the FROM clause serve

acts as a temporary result table that the other query can use

52
New cards

what must be true for two query results to be combined with a set of operations such as union

they must return the same number of columns with compatible data types

53
New cards

what does query-A EXCEPT query-B

rows from query-A that are not in query-b

54
New cards

set operation the preserves duplicate rows

UNION ALL

55
New cards

in JOINs when join on cols have the same name

USING(col name)

56
New cards

joining on two conditions

ON a.col1 = b.col1 AND a.col2 = b.col2

57
New cards

write a query to create a new schema

CREATE SCHEMA ‘schema_name’ ;

58
New cards

Write a query to create a new table with two columns

CREATE TABLE ‘schema’.’table_name’ (

‘col_1’ DATA_TYPE NOT NULL,

‘col_2’ DATA_TYPE NULL

PRIMARY KEY (‘col_1’));

59
New cards

Write a query to select all columns from a table

SELECT * FROM table;

60
New cards

How do you access the ER diagram of your database?

reverse engineering

61
New cards

How do you apply changes from the ER diagram model to the database?

forward engineering

62
New cards

How do you manually add data rows without writing a query?

SELECT * FROM table;

In the query results, you can manually add new rows of data & click APPLY


63
New cards

Many to many relationships require

an intermediary child table from the parent tables defining the relationship


Ex: many students enrolled in many courses requires “enrolled-in” relation between “student” and “course”


64
New cards

How do you add a column to a table?

ALTER TABLE schema.table

ADD col_name datatype;

65
New cards

How do you remove a column from a table?

ALTER TABLE schema.table

DROP COLUMN col_name;

66
New cards

How do you rename a column in a table?

ALTER TABLE schema.table

RENAME COLUMN old_name TO new_name;

67
New cards

How do you change the datatype of a column in a table?

ALTER TABLE schema.table

MODIFY COLUMN col_name datatype;

68
New cards

How do you insert values into a table?

INSERT INTO schema.table(col_1, col_2, col_3, …)

VALUES (col1_val, col2_val,...), (col1_val, …);

69
New cards

How do you change all values in a column?

UPDATE schema.table

SET col_name = value;

70
New cards

Definition Language (DDL)

Defines and modifies the database schema/structure.

CREATE, ALTER, DROP

71
New cards

Which sublanguage is CREATE, ALTER, DROP?

DDL

72
New cards

DML: Data Manipulation Language

Modifies the actual rows/records inside tables.

INSERT, UPDATE, DELETE

73
New cards

Which sublanguage is INSERT, UPDATE, DELETE?

DML

74
New cards

DQL: Data Query Language

Fetches and reads data without changing anything.

SELECT, FROM, WHERE, UNION

75
New cards

Which sublanguage is SELECT, FROM, WHERE, UNION?

DQL

76
New cards

Display Title and Price for books costing more than $30

knowt flashcard image
77
New cards

Display each unique Genre from Book (no duplicates).

knowt flashcard image
78
New cards

Display FirstName, LastName, and Age for customers aged BETWEEN 21 AND 2

knowt flashcard image
79
New cards

Display FirstName and LastName for customers whose LastName starts with M

knowt flashcard image
80
New cards

Display FirstName and LastName for customers whose LastName has exactly five letters and ends with “tone”

or just _tone bc _ is exact

<p>or just _tone bc _ is exact</p>
81
New cards

Count how many different cities appear in Customer. Label the result UniqueCities.

knowt flashcard image
82
New cards

What order do SQL queries execute in after they’re written?

knowt flashcard image
83
New cards

How do you prevent errors in DDL when tables don’t exist?

DROP TABLE IF EXISTS table_name;

84
New cards

How do you add a foreign key to an existing table?

ALTER TABLE table_name

ADD CONSTRAINT fk_name

FOREIGN KEY (col_name)
REFERENCES ref_table(ref_col);

85
New cards

Dropping tables with relationships

a referenced table cannot be dropped while another table depends on it.

delete the dependent table first
ex: if student references department, drop student first

86
New cards

Insert rows from one table into another

knowt flashcard image
87
New cards

Delete rows from a table

knowt flashcard image
88
New cards

Delete all rows from a table without deleting the table or its structure

TRUNCATE TABLE table_name;