SQL and RDBMS

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

1/41

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:31 PM on 1/3/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

42 Terms

1
New cards

What is SQL?

SQL (Structured Query Language) is a language used to manage and manipulate relational databases.

2
New cards

What is a relational database management system (RDBMS)?

An RDBMS organizes data into tables and provides tools for creating, reading, updating, and deleting data using SQL.

3
New cards

What is a database?

A database is a structured collection of data stored electronically for easy access, management, and updating.

4
New cards

What are the sublanguages of SQL?

DDL, DML, DQL, TCL, DCL. DDL defines structures (CREATE, ALTER). DML manipulates data (INSERT, UPDATE). DQL retrieves data (SELECT). TCL manages transactions (COMMIT, ROLLBACK). DCL controls access (GRANT, REVOKE).

5
New cards

What is cardinality?

Cardinality refers to the uniqueness of data in a column or the nature of relationships between tables, such as one-to-one, one-to-many, or many-to-many.

6
New cards

What is a candidate key?

A candidate key is a column or combination of columns that can uniquely identify rows in a table. One candidate key is selected as the primary key.

7
New cards

What is referential integrity?

Referential integrity ensures that relationships between tables remain consistent, such as a foreign key always referencing an existing primary key.

8
New cards

What are primary keys and foreign keys?

Primary Key uniquely identifies each row in a table. Foreign Key references a primary key in another table to establish a relationship.

9
New cards

What are some of the different constraints on columns?

NOT NULL, UNIQUE, CHECK, DEFAULT, PRIMARY KEY, FOREIGN KEY.

10
New cards

What is an entity-relationship diagram (ERD)?

An ERD is a graphical representation of database entities and their relationships, used for database design.

11
New cards

What is the difference between WHERE and HAVING?

WHERE filters rows before grouping. HAVING filters grouped data after aggregation.

12
New cards

What is the difference between GROUP BY and ORDER BY?

GROUP BY groups rows with similar values for aggregate functions. ORDER BY sorts rows in a specified order.

13
New cards

What does LIKE do?

LIKE is used to search for patterns in text using wildcards such as % and _.

14
New cards

How do you use subqueries?

Subqueries are queries within another query, used for dynamic filtering or computations.

15
New cards

How does BETWEEN work?

BETWEEN filters rows within a specified range, inclusive of the boundary values.

16
New cards

What is the order of operations in an SQL statement?

SQL executes clauses in this order: FROM → WHERE → GROUP BY → HAVING → SELECT→ ORDER BY .

17
New cards

What is the difference between aggregate and scalar functions?

Aggregate functions operate on multiple rows and return a single result (e.g., SUM, AVG). Scalar functions operate on individual values (e.g., ABS, UPPER).

18
New cards

What are examples of aggregate and scalar functions?

Aggregate: SUM, AVG, MAX, MIN, COUNT. Scalar: ABS, UPPER, LOWER, ROUND.

19
New cards

What are the different types of joins in SQL?

INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN, CROSS JOIN.

20
New cards

What is a join condition?

The condition specified in the ON clause that defines how rows from two tables are related.

21
New cards

What are the different set operations in SQL?

UNION combines results, removing duplicates. UNION ALL includes duplicates. INTERSECT returns rows present in both result sets.

22
New cards

What is the difference between joins and set operations?

Joins combine columns from multiple tables. Set Operations combine rows from multiple result sets.

23
New cards

How can I create an alias in SQL?

Use the AS keyword to assign an alias to a table or column.

24
New cards

What does the AS keyword do?

Creates a temporary alias for a table or column for the duration of the query.

25
New cards

What is a transaction?

A transaction is a sequence of operations treated as a single logical unit, ensuring data consistency.

26
New cards

What are the properties of a transaction (ACID)?

ACID: Atomicity ensures all operations succeed or fail as a unit. Consistency maintains database integrity. Isolation ensures transactions do not interfere. Durability ensures changes persist after completion.

27
New cards

What are dirty reads, non-repeatable reads, and phantom reads?

Dirty Reads: Reading uncommitted changes. Non-Repeatable Reads: Data changes between reads in the same transaction. Phantom Reads: New rows added during a transaction.

28
New cards

What are transaction isolation levels?

Read Uncommitted, Read Committed, Repeatable Read, Serializable.

29
New cards

What is normalization?

Normalization organizes data to reduce redundancy and improve integrity by dividing it into related tables.

30
New cards

What are the requirements for normalization levels?

1NF ensures atomic values and no repeating groups; 2NF ensures all data should depend on the primary key; 3NF removes transitive dependencies, any non-primary-key column must depend solely on the primary key, not indirectly through another non-key column.

31
New cards

What is an index? What are its advantages and disadvantages?

An index improves query performance by speeding up lookups. Advantages: Faster retrieval. Disadvantages: Slower writes, increased storage.

32
New cards

What is CRUD?

CRUD stands for Create, Read, Update, and Delete — the basic operations for managing data.

33
New cards

What is a view and a materialized view?

View: A virtual table based on a query. Materialized View: A physical storage of query results, periodically refreshed.

34
New cards

What is a DAO?

A Data Access Object (DAO) abstracts database operations to separate application logic from database interaction.

35
New cards

What is the danger of putting values directly into queries?

It exposes the system to SQL injection, where malicious users can manipulate SQL queries to compromise data.

36
New cards

What is a port number? What is the default port for MySQL?

A port number is a communication endpoint. MySQL’s default port is 3306.

37
New cards

What is multiplicity?

Multiplicity defines the cardinality of relationships between entities: 1-to-1, 1-to-Many, Many-to-Many.

38
New cards

What is the CAP Theorem?

The CAP Theorem states that a distributed system can guarantee at most two out of three properties: Consistency, Availability, Partition Tolerance.

39
New cards

What does CAP mean during network problems?

During network partitions, distributed systems must sacrifice either consistency or availability.

40
New cards

What does it mean for an operation or transaction to be atomic?

An atomic operation is indivisible; it either completes entirely or does not occur at all.

41
New cards

What does ACID stand for?

ACID: Atomicity, Consistency, Isolation, Durability.

42
New cards

What does BASE stand for?

BASE: Basically Available, Soft-state, Eventual Consistency. This is a model used in distributed systems as an alternative to the ACID properties of traditional databases, emphasizing availability over strict consistency.