Foundations: Data Models & Queries with Filters

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

1/34

flashcard set

Earn XP

Description and Tags

Week 1,2,3

35 Terms

1
New cards

Why Do DB’s exist?

to store data without repeating information

splits related data into separate tables

NOT a better spreadsheet

2
New cards

What is a data model?

Way to organize and represent real world data

What is stored and how it it is related

3
New cards

What is a flat file

one file (like a CSV) uniform records, relationships NOT explicit

4
New cards

Network?

a graph where records are nodes and relationships are directed edges (no cycles)

5
New cards

Hierarchical

tree of a parent-child records

6
New cards

Relational?

data in tables of rows and cols that can link to each other

7
New cards

DBMS vs. RDBMS

DBMS: software that creates, manages and queries and database
RDBMS: a DBMS for relational databases, usually queried with SQL

8
New cards

5 parts of an RDBMS?

Data storage

Metadata

Schema (logical blueprint)

Query processor (prices, validates and optimizes)

Memory manager

9
New cards

What are the 3Vs of Big Data

Volume, Velocity, Variety

10
New cards

What are 3 things a data model specifies?

Structure, Manipulation and Integrity.

11
New cards

Relation = ?

Table. Each table reps. one entity type (customer, product)

12
New cards

Tuple = ?

Row = record. One instance of the entity. Rows are unique and unordered

13
New cards

Attribute = ?

Column = field. Named, typed, and single-valued

14
New cards

What is a Primary key?

One or more columns that uniquely identify each row. Shown underlined in a schema

15
New cards

3 required properties of a PK

Unique, never NULL, constant (does NOT change over time)

16
New cards

What if no single column is unique?

Combine columns into a composite PK

17
New cards

What is a foreign key?

Columns in a child table that refer to the PK of a parent table. Shown in italics in a schema.

18
New cards

How do you model 1:1 and 1:m relationships?

A bridge(junction) table holding both FKs

EX: Enroll student_id, course_id between Student & Course

19
New cards

Why not just put an FK for m:n relationships?

One cell would need several values, which breaks the single - values rule for columns

20
New cards

5 Table design rules?

1. One table per entity type or m:n relationship

2. Columns = attributes

3. Each column gets the best-fit data type.

4. Every table has a PK

5. 1:1 and 1:m use FKs in the child table

21
New cards

Common data types?

CHAR (fixed length)
VARCHAR (variable length)
ENUM (fixed set)
INT
DOUBLE
DATE/DATETIME
BOOL
BLOB
TEXT

22
New cards

SQL is declarative. What does that mean?

You say what result you want, not how to get it.

23
New cards

DDL commands?

Data definition (structure)

CREATE
ALTER
DROP
TRUNCATE
RENAME

24
New cards

What is the purpose of data definition?

Define structure

25
New cards

DML commands?

Data Manipulation (data)

SELET

INSERT

UPDATE

DELETE

26
New cards

What is the purpose of data manipulation?

Work with the data

27
New cards

TCL commands?

Transaction Control: Group statements

START TRANSACTION

COMMIT

ROLLBACK

SAVEPOINT

28
New cards

DCL commands?

Data Control (permissions):

GRANT

REVOKE

29
New cards

What does CRUD stand for?

Create: INSERT

Read: SELECT

Update: UPDATE

Delete: DELETE

30
New cards

Order of SELECT clauses as written?

SELECT

FROM

WHERE

GROUP BY

HAVING

ORDER BY

31
New cards

Relational vs. NoSQL: schema?

Relational: fixed, predefined

NoSQL: flexible or schema-less

32
New cards

Relational vs. NoSQL: scaling?

Relational: vertical (a bigger server)

NoSQL: horizontal (more servers)

33
New cards

Relational vs NoSQL: consistency?

Relational: strong (ACID)

NoSQL: often eventual

34
New cards

4 NoSQL types + example?

Document (MongoDB, JSON-like)

wide column (Cassandra),

graph (Neo4j nodes + relationships)

key-value (very fast lookups)

35
New cards

Typical use cases?

Relational: banking, ERP, structured business data

NoSQL: social media, IoT, real-time analytics, unstructured data