Relational DB Flashcards
(102 cards)
- What are the three components of a database model?
Data structure → describes how data is organized
Operations → manipulates data structures
Rules → govern valid data
- What is a tuple?
a tuple is an ordered collection
- What is a set?
a set is an unordered collection of elements enclosed in braces
- {a,b,c} and {c,b,a} are the same because order doesn’t matter
- How is a relational database structure organized?
a table has a name, a fixed tuple of columns, and varying sets of rows
- a column has a name and a data type
- a row is an unnamed tuple of values. each value corresponds to a column and belongs to the columns data type
- a data type is a named set of values from which column values are drawn
Describe ‘select’
Selectselects a subset of rows of a table.
Describe ‘project’
Project eliminates one or more columns of a table.
- Describe ‘product’
- Productlists all combinations of rows of two tables.
- Describe ‘join’
- Joincombines two tables by comparing related columns.
- Describe ‘union’
- Unionselects all rows of two tables.
- Describe ‘intersect’
Intersect selects rows common to two tables.
- Describe ‘difference’
Difference selects rows that appear in one table but not another.
- Describe ‘rename’
- Renamechanges a table name.
- Describe ‘aggregate’
- Aggregate computes functions over multiple table rows, such as sum and count.
- What are the three logical constraints in relational database management that ensure data is valid?
- Unique primary key → all tables have a primary key column, or group of columns, in which values may not repeat
- Unique column names → Different columns of the same table have different names
- No duplicate rows → No two rows of the same table have identical values in all columns
- What does SQL stand for?
Structured Query Language
- What is a ‘statement’?
- A statement is a complete command composed of one or more clauses
- What is a ‘clause’?
- A clause groups SQL keywords like SELECT, FROM, and WHERE with table names
- What are some key words in SQL?
SELECT, FROM, WHERE
- How do you end a statement in MySQL?
a semi-colon, “ ; “
- What is DDL and what is it responsible for?
- Data definition language (DDL) → Defines the structure of the database
- What is DQL and what is it responsible for?
- Data query language (DQL) → Retrieves data from the database
- What is DML and what is it responsible for?
- Data manipulation language (DML)→ Manipulates data stored in a database
- What is DCL and what is it responsible for?
- Data control language (DCL) → Controls database user access
- What is DTL and what is it responsible for?
- Data transaction language (DTL) → Manages database transactions. commits data to a database, rolls back data from a database, and creates save points.