db qyuz 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/197

encourage image

There's no tags or description

Looks like no tags are added yet.

198 Terms

1
New cards

What is a database?

A collection of related data representing a real-world scenario.

2
New cards

What is a DBMS?

Software for storing, querying, managing, and analyzing a database.

3
New cards

What is a data model?

A way to represent a real-world scenario inside a database.

4
New cards

What three concepts form the basis of a data model?

Entities, attributes, and relationships.

5
New cards

What is the difference between a database and a DBMS?

A database is the stored data; a DBMS is the software that manages it.

6
New cards

Why use a DBMS instead of separate application files?

To support structured storage, efficient queries, and shared data management.

7
New cards

What is a query?

A request to retrieve or manipulate data in a database.

8
New cards

What are the two broad sides of CS564?

Database application/design and DBMS system internals.

9
New cards

What is an entity in ER modeling?

A distinguishable real-world object of interest, such as a Student.

10
New cards

What is an entity set?

A collection of entities of the same type.

11
New cards

What is an attribute?

A property describing an entity or relationship.

12
New cards

What is a relationship in an ER model?

An association among entities.

13
New cards

What does ER stand for?

Entity–Relationship.

14
New cards

What is conceptual database design?

Modeling entities, attributes, and relationships before implementing tables.

15
New cards

What is an ER diagram used for?

A graphical representation of a database's conceptual structure.

16
New cards

What is a binary relationship?

A relationship involving two entity sets.

17
New cards

What is a multiway relationship?

A relationship involving more than two entity sets.

18
New cards

What is a one-to-one relationship?

Each entity on either side is associated with at most one on the other.

19
New cards

What is a many-to-one relationship?

Many entities on one side may relate to one entity on the other.

20
New cards

What is a many-to-many relationship?

Multiple entities on each side may relate to multiple on the other.

21
New cards

What do arrows indicate in ER relationship notation?

Key constraints on the relationship, such as at-most-one participation.

22
New cards

Why do ER diagrams use roles?

To distinguish multiple uses of the same entity set in one relationship.

23
New cards

Why avoid multi-valued lists in a relational cell?

Relational attributes are expected to hold atomic values.

24
New cards

What comes after conceptual design in building a database?

Translate the ER model into a relational schema and implement it.

25
New cards

What is a relation?

A table consisting of tuples and attributes.

26
New cards

What is a tuple?

One row in a relation.

27
New cards

What is an attribute? (Lecture 3)

One named column in a relation.

28
New cards

What is an attribute domain?

The permitted atomic data type or set of values for an attribute.

29
New cards

How is an entity set translated into a relation?

Make a table with a column for each attribute and the entity key.

30
New cards

How is an ER relationship normally translated into tables?

Create a relation with participating entity keys and relationship attributes.

31
New cards

When can a relationship be combined into an entity table?

When key constraints make storing a foreign key in one entity table appropriate.

32
New cards

What is a key?

An attribute set that uniquely identifies an entity or tuple.

33
New cards

What is a candidate key?

A minimal attribute set that uniquely identifies a tuple.

34
New cards

Can an entity set have several candidate keys?

Yes; different attribute sets can each uniquely identify entities.

35
New cards

What does a primary key do?

Designates the chosen unique identifier for tuples.

36
New cards

What is a weak entity set?

An entity set whose identification depends on an owner entity set.

37
New cards

How is a weak entity identified?

By its partial key together with the owner's key.

38
New cards

What does an ISA relationship represent?

A subclass is a specialized kind of superclass.

39
New cards

What does a subclass inherit?

Attributes and relationships of its superclass.

40
New cards

What is the object-oriented translation of subclasses?

One relation per class containing inherited and local attributes.

41
New cards

What is the ER-style translation of subclasses?

One superclass table and subclass tables containing keys and subclass attributes.

42
New cards

What is the single-table NULL translation of subclasses?

One relation with columns for every subclass and NULLs where inapplicable.

43
New cards

What is a drawback of the single-table subclass approach?

Many NULLs with potentially different meanings.

44
New cards

What is the difference between at-most-one and exactly-one participation?

At-most-one permits zero; exactly-one requires one.

45
New cards

What is a database constraint?

A condition that all valid database states must satisfy.

46
New cards

What does SQL stand for?

Structured Query Language.

47
New cards

What is the basic SQL query pattern?

SELECT columns FROM tables WHERE row condition.

48
New cards

What does SELECT specify?

The output expressions or columns.

49
New cards

What does FROM specify?

The input table or tables.

50
New cards

What does WHERE specify?

Conditions filtering candidate rows.

51
New cards

What does SELECT * mean?

Return all columns of the selected rows.

52
New cards

How can you rename a column in a query result?

Use AS with an alias in SELECT.

53
New cards

What are SQL aliases used for?

Renaming output columns or referring to tables concisely.

54
New cards

Can SELECT contain computed expressions?

Yes; expressions can calculate output values.

55
New cards

How do AND and OR differ in WHERE?

AND requires both predicates; OR requires at least one.

56
New cards

What does NOT do in a WHERE condition?

Negates a Boolean predicate.

57
New cards

What does SQL LIKE do?

Matches strings against a pattern.

58
New cards

What does % mean in a LIKE pattern?

Any sequence of zero or more characters.

59
New cards

What does _ mean in a LIKE pattern?

Exactly one character.

60
New cards

How do you match strings beginning with A?

WHERE column LIKE 'A%'.

61
New cards

What is the role of DISTINCT?

Remove duplicate result rows.

62
New cards

Why can an SQL query return duplicate rows?

SQL normally uses bag rather than set semantics.

63
New cards

How are text literals typically written in SQL?

With single quotation marks.

64
New cards

How do you query more than one table in SQL?

List multiple tables in FROM and relate them with WHERE conditions.

65
New cards

What is a Cartesian product of two relations?

Every possible pair of rows from the two relations.

66
New cards

What happens if a multi-table query lacks a join condition?

It can produce an unintended Cartesian product.

67
New cards

How do you disambiguate a shared column name?

Prefix it with a table name or alias, such as R.id.

68
New cards

What is a join condition?

A predicate matching related rows across tables.

69
New cards

How can indexes improve a multi-table query?

Quickly locate rows satisfying filters and matching join keys.

70
New cards

What does FROM Product AS P do?

Assigns the tuple variable or alias P to Product.

71
New cards

What is a self-join?

Joining a table to itself using separate aliases.

72
New cards

What does COUNT(*) compute?

The number of rows in a group or result.

73
New cards

What does AVG(column) compute?

The average of non-NULL values in that column.

74
New cards

What do MIN and MAX compute?

The smallest and largest non-NULL values.

75
New cards

What does SUM(column) compute?

The sum of non-NULL values.

76
New cards

What is the purpose of GROUP BY?

Partition rows into groups for aggregate calculations.

77
New cards

What is HAVING used for?

Filter groups after aggregation.

78
New cards

How does HAVING differ from WHERE?

WHERE filters input rows; HAVING filters groups.

79
New cards

What is the standard aggregation clause order?

SELECT; FROM; WHERE; GROUP BY; HAVING.

80
New cards

How would you find the average price per store?

SELECT store, AVG(price) FROM Sells GROUP BY store.

81
New cards

How do you keep only stores with AVG(price) > 20?

GROUP BY store HAVING AVG(price) > 20.

82
New cards

What does SQL NULL represent?

A missing, unknown, or inapplicable value.

83
New cards

Does x = NULL test for a NULL value?

No; use x IS NULL.

84
New cards

How do you find rows whose column is not NULL?

WHERE column IS NOT NULL.

85
New cards

What is SQL's three-valued logic?

Predicates can be TRUE, FALSE, or UNKNOWN.

86
New cards

How does WHERE treat UNKNOWN?

Only TRUE rows pass the filter.

87
New cards

What is a subquery?

A query nested inside another SQL statement.

88
New cards

What does IN (subquery) test?

Whether a value belongs to the subquery's result set.

89
New cards

What does EXISTS (subquery) test?

Whether the subquery produces at least one row.

90
New cards

What does NOT EXISTS test?

Whether a subquery produces no rows.

91
New cards

What does comparison with ANY mean?

The comparison holds for at least one returned value.

92
New cards

What does comparison with ALL mean?

The comparison holds for every returned value.

93
New cards

What is a correlated subquery?

A subquery that refers to values from its surrounding query.

94
New cards

What does CREATE TABLE do?

Define a new relation and its column constraints.

95
New cards

What does DROP TABLE do?

Remove a table definition from the database.

96
New cards

What does INTEGER specify?

An integer-valued column type.

97
New cards

What does VARCHAR(n) specify?

A varying-length character string up to length n.

98
New cards

What does CHAR(n) specify?

A fixed-length character string of length n.

99
New cards

What does NOT NULL require?

Each row must have a non-NULL value in that column.

100
New cards

What does UNIQUE enforce?

Values of the constrained key are not repeated, subject to NULL rules.