Lesson 2 Flashcards
relational database
Conceptual framework for a database systems with 3 parts:
-data structures: how data is organized
-operations: that manipulate data structures
-rules: logical constraints that ensure data is valid
set
unordered collection of elements enclosed in braces
Ex: {a,b,c} and {c,b,a}
tuple
ordered collection of elements enclosed in parentheses
table
has a name, a fixed tuple of columns, and a varying set of rows
Synonyms: Tables, File, Relation
column
has a name and a data type
Synonyms: Column, Field, Attribute
row
-unnamed tuple of values
-since rows are a set, rows have no inherit order
Synonyms: Row, Record, Tuple
relational data type
a data type is a named set of values, from which column values are drawn
relational algebra
theoretical foundation of the SQL language
relational rules
-rules are logical constraints that ensure data is valid
-govern data in every relational database
Relational Operations: SELECT
selects a subset of rows of a table
Relational Operations: JOIN
combines two tables by comparing related columns
Relational Operations: UNION
selects all rows of two tables
Relational Operations: AGGREGATE
computes functions over multiple table rows, such as sum and count
Business rules
based on business policy and specific to a particular database
Ex: All rows of the ‘Employee’ table must have a valid entry in the ‘DepartCode’ column
Structured Query Language/SQL
-high-level computer language for storing, manipulating, and retrieving data
-standard language for relational database
SQL statement Literals
Strings: must be surrounded by single or double quotes
Numeric: 123
Binary: represented with x’0’ where the 0 is any hex values
Data Definition Language (DDL)
defines the structure of the database
CREATE, ALTER, DROP
Data Manipulation Language (DML)
manipulates data stored in a database
INSERT, UPDATE, DELETE
Data Query Language (DQL)
retrieves data from database
SELECT
Data Control Language (DCL)
controls database user access
GRANT, REVOKE
Data Transaction Language (DTL)
manages database transactions
SAVEPOINT, ROLLBACK, COMMIT
table
has a name, fixed sequence of columns (tuples), and a varying set of rows
table rules
-one value per cel
-Unknown data is represented with NULL
-no duplicate column names in the same table
-no duplicate rows
-no row order
column
has a name and a data type
row
unnamed sequence of values