Lesson 2 Flashcards

(63 cards)

1
Q

relational database

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

set

A

unordered collection of elements enclosed in braces
Ex: {a,b,c} and {c,b,a}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

tuple

A

ordered collection of elements enclosed in parentheses

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

table

A

has a name, a fixed tuple of columns, and a varying set of rows
Synonyms: Tables, File, Relation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

column

A

has a name and a data type
Synonyms: Column, Field, Attribute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

row

A

-unnamed tuple of values
-since rows are a set, rows have no inherit order
Synonyms: Row, Record, Tuple

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

relational data type

A

a data type is a named set of values, from which column values are drawn

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

relational algebra

A

theoretical foundation of the SQL language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

relational rules

A

-rules are logical constraints that ensure data is valid
-govern data in every relational database

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Relational Operations: SELECT

A

selects a subset of rows of a table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Relational Operations: JOIN

A

combines two tables by comparing related columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Relational Operations: UNION

A

selects all rows of two tables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Relational Operations: AGGREGATE

A

computes functions over multiple table rows, such as sum and count

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Business rules

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Structured Query Language/SQL

A

-high-level computer language for storing, manipulating, and retrieving data
-standard language for relational database

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

SQL statement Literals

A

Strings: must be surrounded by single or double quotes
Numeric: 123
Binary: represented with x’0’ where the 0 is any hex values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Data Definition Language (DDL)

A

defines the structure of the database

CREATE, ALTER, DROP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Data Manipulation Language (DML)

A

manipulates data stored in a database

INSERT, UPDATE, DELETE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Data Query Language (DQL)

A

retrieves data from database

SELECT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Data Control Language (DCL)

A

controls database user access

GRANT, REVOKE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Data Transaction Language (DTL)

A

manages database transactions

SAVEPOINT, ROLLBACK, COMMIT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

table

A

has a name, fixed sequence of columns (tuples), and a varying set of rows

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

table rules

A

-one value per cel
-Unknown data is represented with NULL
-no duplicate column names in the same table
-no duplicate rows
-no row order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

column

A

has a name and a data type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
row
unnamed sequence of values
26
cell
single column of a single row
27
empty table
table without rows
28
ALTER TABLE
DDL adds, delete, or modifies
29
Data types: INT
positive or negative integer values
30
Data types: VARCHAR(N)
values with 0 to N characters
31
Data types: DATE
Date values YYYY-MM-DD
31
Data types: CHAR(N)
fixed string value
32
Dat types: TIME
hh:mm:ss
33
Data types: DATETIME
YYYY-MM-DD HH:MM:SS
34
Data types: DECIMAL
numeric values of which digits follow the decimal point
35
Integer Storage
36
Operator
operator is a symbol that computes a value from one or more values, called operands
37
Arithmetic operators
compute numeric values from operands
38
Comparison operators
compute logic values TRUE or FALSE
39
Logical operators
compute of logical values from logical operand
40
Operator/Operand
41
Operator precedence
42
NULL
value that represents unknown or inapplicable data
43
INSERT
adds rows to a table
44
UPDATE
uses SET clause to specify new column values optional WHERE clause specifies which rows are updated
45
DELETE
deletes existing rows in a table
46
TRUNCATE
deletes all rows from a table
47
MERGE
-selects data from one table, called the source, and inserts the data to another table, called the target - MySQL does not support MERGE
48
Primary Keys
a column, or a group of columns, used to identify a row Must be: UNIQUE NOT NULL
49
Simple primary key
consists of a single column
50
Composite primary key
consist of multiple columns
51
auto-increment
numeric column that is assigned an automatically incrementing value when a new row is inserted
52
foreign key
column, or group of columns, that refer to primary key
53
foreign key constraint
when specified, database rejects insert, update, and delete statements that violate referential integrity
54
fully NULL
simple or composite foreign key in which all columns are NULL
55
Referential integrity
relational rule that requires foreign key values are NULL or match primary key value
56
RESTRICT
rejects an insert update, or delete that violate referential integrity
57
RESTRIC, SET NULL, SET DEFAULT
Applies to primary key update and delete Applies to foreign key insert and update
58
CASCADE
propagates primary key changes to foreign keys applies to primary key update and delete only
59
Constraint
rule that governs allowable values in a database
60
UNIQUE
ensures that values in a column, or group of columns, are unique
61
CHECK
-specifies an expression on one or more columns of a table. -constraint is violated when the expression is FALSE and satisfied when the expression is either TRUE or NULL.
62
SQL CONSTRAINT