Section 2 Flashcards

(42 cards)

1
Q

A database model is a conceptual framework for database systems, with three parts:

A

-Data structures that prescribe how data is organized
-Operations that manipulate data structures
-Rules that govern valid data

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

What is a Tuple

A

It is an ordered collection of elements enclosed in parentheses Ex: (a,b,c) and (c,b,a) are different, since tuples are ordered.

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

A table

A

Has a name, a fixed tuple of columns, and a varying set of rows

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

A column

A

Has a name and a data type

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

A row

A

Is an unnamed tuple of values. Each corresponds to a column and belongs to the column’s data type

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

A data type

A

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
7
Q

Join

A

Combines two tables by comparing related columns

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

Union

A

Selects all rows of two tables

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

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
10
Q

Business rules

A

Are based on business policy and specific to a particular database

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

SQL

A

Is the standard language for relational databases, and is commonly supported in non-relational databases

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

Type: Literals
Definition: ?
Examples: ?

A

Description: Explicit values that are string, numeric, or binary. Strings must be surrounded by single quotes or double quotes.
Binary values are represented with x ‘0’ where 0 is any hex value.
Ex: ‘String’, “String”, 123, x’0fa2’

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

Type: Keywords
Description:?
Ex:?

A

Description: Words with special meaning.
Ex: SELECT, WHERE, FROM

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

Type: Identifiers
Description: ?
Ex: ?

A

Description: Objects from the database like tables, columns, etc.
Ex: City, Name, Population

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

The SQL language is divided into five sublanguages

A

-Data definition language(DDL)
-Data Query Language(DQL)
-Data Manipulation Language(DML)
-Data control Language(DCL)
-Data Transaction Language(DTL)

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

Data Definition Language

A

Defines the structure of the data

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

Data Query Language

A

Retrieves data from the database

18
Q

Data Manipulation Language

A

Manipulates data stores in a database

19
Q

Data Control Language

A

Controls database user access

20
Q

Data Transaction Language

A

Manages database transactions

21
Q

What is rule 7 of a table?

A

No row order: Rows are not ordered. the organization of rows on a storage device, such as a disk drive, never affects query results

22
Q

Rule 7 is called?

A

Data independence, it allows database administrators to improve query performance by changing the organization of data on storage devices, without affecting query results.

23
Q

Example data types

A

-INT or INTEGER : Integer values
-VARCHAR(N) : values with 0 to N characters
-DATE : date values
-DECIMAL(M,D) : numeric values with M digits, of which D digits follow the decimal point

24
Q

ALTER TABLE statement..

A

Adds, deletes, or modifies columns on an existing table.

25
A data type is
A named set of values from which column values are drawn
26
Integer data types
Represent positive and negative integers. Several integer data types exist, varying by the number of bytes allocated for each value. Common integer data types include INT, implemented as 4 bytes of storage, and SMALLINT, implemented as 2 bytes.
27
Null
Is a special value that represents either unknown or inapplicable data
28
The update statement
Modifies existing rows in a table. Uses the SET clause to specify the new column values.
29
The DELETE statment
Deletes existing rows in a table. The FROM keyword is followed by the table name whose rows are to be deleted.
30
The TRUNICATE statement
deletes all rows from a table. It is nearly identical to a DELETE statment with no WHERE clause except for minor differences that depend on the database system.
31
The MERGE statement
Selects data from one table, called the source, and inserts the data to another table, called the target.
32
A primary key
Is a column, or group of columns, used to identify a row. The ---- is usually the table's first column.
33
A single primary key A composite primary key
Consists of a single-column Consists of multiple columns
34
An auto-increment column
is a numeric column that is assigned an automatically incrementing value when a new row is inserted.
35
Database users occasionally make the following errors when inserting primary keys
-Inserting values for auto-incrementing primary keys -Omitting values for primary keys that are not auto-increment columns
36
A foreign key
Is a column, or group of columns, that refers to a primary key. When a foreign key constraint is specified, the database rejects insert, update, and delete statements that violate referential integrity.
37
RESTRICT
rejects an insert, update, or delete that violates referential integrity
38
CASCADE
Propagates primary ley changes to foreign keys.
39
A constraint
Is a rule that governs allowable values in a database. ---- are based on relational and business rules.
40
The UNIQUE constraint
Ensures that values in a column, or group of columns are unique
41
The CHECK constraint
Specifies an expression on one or more columns of a table
42
Adding and dropping contraints
Constraints are added and dropped with the ALTER TABLE TableName followed by an ADD, DROP, or CHANGE clause.