Relational Databases Flashcards
A blank is a conceptual framework for database systems.
Database model
A database model has what three parts:
Data structures
Operations on data structures
Rules that govern valid data
Blank present how data is organized
Data structures
Blank manipulate data structures
Operations
Blank govern valid data
Rules
The relational model is a database model based on a blank table structure
Tabular
The relational model was published in 1970 by who of what company.
E. F. Codd of IBM
When was relational model released in commercial products?
1980
What database models were dominant in the 1960s and 70s
Hierarchical and network databases
Since computers were relatively slow and memory was limited, hierarchical and network databases were optimized for what at the expense of simplicity and flexibility?
Performance
Relational databases were originally designed for what data?
Transactional
What type of primary data structure does the hierarchical database model have?
Tree
What type of primary data structure does a network database model use?
Linked list
What type of primary data structure does the object database model have?
Class
What type of primary data structure does the graph database model use?
Vertex and edge
What type of primary data structure does the document database model use?
XML or JSON
Relational data structures are based on what theory?
Set theory
A blank is an unordered collection of elements in braces
Set
A blank is an ordered collection of elements enclosed in parentheses.
Tuple
A blank has a name, a fixed tuple of columns and a varying set of rows
Table
A blank has a name and data type.
Column
A blank is an unnamed tuple of values that corresponds to a column and belongs to the column’s data type
Row
A blank is a named set of values from which columns are drawn
Data type
What are the equivalent terms in mathematics for table, column, row and data type.
Relation
Attribute
Tuple
Domain
What are the equivalent terms in files for table, columns, row and data types?
File
Field
Record
Data type
What relational operation grabs a subset of rows of a table?
SELECT
What relational operation eliminates one or more columns of a table?
Project
What relational operation lists all combinations of rows of two tables?
PRODUCT
What relational operation combines two tables by comparing related columns?
JOIN
What relational operation selects all rows of two tables?
UNION
What relational operation selects rows common to two tables?
INTERSECT
What relational operation selects rows that appear in one table but not another
DIFFERENCE
What relational operation changes a table name?
RENAME
What relational operation computes functions over multiple table rows, such as sun and count
AGGREGATE
Relational operations are collectively called what and are the theoretical foundations of the SQL language?
Relational algebra
Blank are logical constraints that ensure data is valid
Rules
Blank are part of the relational model and govern data in every relational database
Relational rules
All tables have a blank column, or group, in which values cannot repeat
Unique primary key
Relational databases require blank in that different columns of the same table have different names
Unique column names
Relational databases require blank in that no two rows have identical values in all columns
No duplicate rows
Blank are based on business policy and specific to a particular database
Business rules
Relational rules are implemented as what
SQL constraints
Relational rules are enforced by what
The database system
Blank are discovered during database design and are often implemented with SQL constraints
Business rules
Blank is a high-level computer language for storing, manipulating, and retrieving data
SQL
Blank support most important elements of sql standard, however, most don’t support the entire standard
Relational databases
A blank uses sql to insert, retrieve, update, and delete data from the tables
Database user
A blank uses sql to create a database and the database tables
Designer
A blank is a complex command composed of one or more clauses
SQL statement
A blank groups sql keywords with table names and conditions
Clause
Good prep rice is to write sql statements like what
Each clause on a separate line
Name the three clauses in a select statement
SELECT
FROM
WHERE
Sql statements end with a what
Semicolon
Clauses that end with a semicolon in sql are called what
Statement
In sql blank are case sensitive
Column names and table names
In sql blank are not case sensitive
Sql keywords
In sql blank are explicit values that are string, numeric, or binary
Literals
In sql strings must be surrounded by a single or double what?
Quote
Blank are represented with x ‘0’ where the 0 is any hex value
Binary values
In sql blank are words with special meanings
Keywords
In sql blank are objects from the database like tables, columns, etc
Identifiers
In sql blank are statements intended only for humans and ignored by the database when parsing an sql statement
Comments
What do you use for a single line comment on sql
- -
What do you use for a multiline comment in sql
/*
All databases recognize what for string literals while only some recognize what
Single quotes
Double quotes
The sql language is divided into five subcategories. Name them
1) data definition language(DDL)
2) data query language (DQL)
3) data manipulation language (DML)
4) data control language (DCL)
5) data transaction language (DTL)
Blank is a subcategory of sql that defines the structure of the database
Data Definition Language (DDL)
Blank is a subcategory of sql that retrieves data from the database
Data Query Language (DQL)
Blank is a subcategory of sql that manipulates data stirred in a database
Data Manipulation Language (DML)
Blank is a subcategory of sql that controls database user access
Data Control Language (DCL)
Blank is a subcategory of sql that manages database transactions
Data Transaction Language (DTL)
Blank creates, alters, and drops tables
DDL
Blank selects data from a table
DQL
Blank inserts, updates, and deletes data in a table
DML
Blank grants and revokes permissions to and from users
DCL
Blank commits data to a database, rolls back data from a database, and creates save points
DTL
A blank is a series of sql statements that is executed repeatedly
Automated script
Blank are prepared in advance and saved in a file or a database stored procedure. They are executed by a computer program or from the sql command line by invoking the name of the file or stored procedure
Automated script
A blank is a single executing copy of a database system
Database system instance
Personally computers usually just run how many instances of a database system
One
Shared computers usually run how many instances of a database system
Many
Name the two sql commands that help database admins, users, and designers manage the database on an instance
CREATE DATABASE
DROP DATABASE
What is the correct syntax for creating a database
CREATE DATABASE DatabaseName
What is the correct syntax for deleting a database and all tables in the database
DROP DATABASE DatabaseName;
The what is automatically installed in MySQL database system and used for system admin
MySQL database
Blank statements provide information about databases
SHOW
What sql command shows all the database system instances
SHOW DATABASES;
What is the sql syntax to list all tables in the default database
SHOW TABLES;
What is the sql syntax for listing all columns in a particular table of the default database
SHOW COLUMNS FROM TableName;
How do you obtain the create table statement for a table in the default database
SHOW CREATE TABLE TableName;
All data is a relational database is structured in blank
Tables
A blank has a name, a fixed sequence of columns, and a varying set of rows
Table
A blank has a name and data type
Column
A blank is an unnamed sequence of values that corresponds and belongs to the column’s data type
Row
A blank is a single column of a single row
Cell
A table must have at least one what, but any number of what?
Column
Rows
A table without rows is called a what
Empty table
Tables must obey what?
Relational rules
A cell must not contain what?
Multiple values
Blank are allowed in different tables, but not the same table
Duplicate column names
No blank can have identical values in all columns
Two rows
Rows are not what?
Ordered
The organization of rows on a storage device must never what?
Affect query results
Name the four relational rules governing tables
Exactly one value per cell
No duplicate column names
No duplicate rows
No row order
Blank allows database admins to improve query performance by changing the organization of data on storage devices without affecting no query results
Data independence
Blank tables allows tables with duplicate rows
Temporary
What sql statement creates a new table by specifying the table name, column names, and column data types? Give the syntax
CREATE TABLE TableName
ColumnName DataType;
Give the syntax for deleting a table and all of the columns in it
DROP TABLE TableName;
Name the syntax for adding a column into an existing table
ALTER TABLE TableName
ADD ColumnName DataType;
Name the syntax for modifying an existing column in a table
ALTER TABLE TableName
CHANGE CurrentColumnName NewColumnName NewDataType;
Name the syntax for deleting an existing column in a table
ALTER TABLE TableName
DROP ColumnName;
Name the way to change a column’s data type
ALTER TABLE TableName
CHANGE ColumnName ColumnName NewDataType;
Blank is an operation in a table in which rows become columns and columns become rows. It is an important operation in mathematics, but is commonly applied to tables
Transpose
A blank is a named set of values from which column values are drawn.
Data type
Name the seven general data types
1) integer
2) decimal
3) character
4) date
5) binary
6) spatial
7) document
Blank data types represent positive and negative integers
Integer
Blank data types represent numbers with fractional values
Decimal
Blank data types represent textual characters
Character
Blank data types represent day and time or both
Date
Blank data types store data exactly as the data appears in memory or computer files, but for bit
Binary
Blank data types contain textual data in a structured format like XML or JSON
Document
A blank data type stores data as an exact copy of memory?
Binary
All relational databases support what four data types?
Integer, decimal, date and time, and character
Most databases allow integer and decimals to be what
Signed or unsigned
A signed number may be what
Negative
A blank cannot be negative
An unsigned number
Data types vary in what
Storage requirements
Blank data types use in or two bytes per character
Character
Blank data types use a fixed number of bytes per number
Integer
Blank data types store larger numbers than the blank version of the same number
Unsigned , signed
To minimize table size, the data type with the blank should be used
Smallest storage requirements
What data type has a storage size of 1 byte?
TINYINT
What is the TINYINT range for a SiGNeD
-128 - 127
What is the range for TINYINT UNSIGNED
0 - 255
What integer data type has 2 bytes of storage.
SMALLINT
What is the number range for SMALLINT signed?
-32768 to 32767
What is the number range for SMALLINT unsigned?
0 to 65535
What integer data type uses 3 bytes of storage?
MEDIUMINT
What is the number range for MEDIUMINT signed?
-8388608 to 8388607