Section 2 Flashcards
(42 cards)
A database model is a conceptual framework for database systems, with three parts:
-Data structures that prescribe how data is organized
-Operations that manipulate data structures
-Rules that govern valid data
What is a Tuple
It is an ordered collection of elements enclosed in parentheses Ex: (a,b,c) and (c,b,a) are different, since tuples are ordered.
A table
Has a name, a fixed tuple of columns, and a varying set of rows
A column
Has a name and a data type
A row
Is an unnamed tuple of values. Each corresponds to a column and belongs to the column’s data type
A data type
Is a named set of values, from which column values are drawn
Join
Combines two tables by comparing related columns
Union
Selects all rows of two tables
Aggregate
Computes functions over multiple table rows, such as sum and count
Business rules
Are based on business policy and specific to a particular database
SQL
Is the standard language for relational databases, and is commonly supported in non-relational databases
Type: Literals
Definition: ?
Examples: ?
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’
Type: Keywords
Description:?
Ex:?
Description: Words with special meaning.
Ex: SELECT, WHERE, FROM
Type: Identifiers
Description: ?
Ex: ?
Description: Objects from the database like tables, columns, etc.
Ex: City, Name, Population
The SQL language is divided into five sublanguages
-Data definition language(DDL)
-Data Query Language(DQL)
-Data Manipulation Language(DML)
-Data control Language(DCL)
-Data Transaction Language(DTL)
Data Definition Language
Defines the structure of the data
Data Query Language
Retrieves data from the database
Data Manipulation Language
Manipulates data stores in a database
Data Control Language
Controls database user access
Data Transaction Language
Manages database transactions
What is rule 7 of a table?
No row order: Rows are not ordered. the organization of rows on a storage device, such as a disk drive, never affects query results
Rule 7 is called?
Data independence, it allows database administrators to improve query performance by changing the organization of data on storage devices, without affecting query results.
Example data types
-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
ALTER TABLE statement..
Adds, deletes, or modifies columns on an existing table.